Fixed bug where C# Asset implicit bool conversion operators were internal #411

Merged
Pycorax merged 1 commits from SP3-6-c-scripting into main 2023-03-10 14:14:59 +08:00
7 changed files with 76 additions and 66 deletions

View File

@ -34,18 +34,22 @@ namespace SHADE.Test
// Play animations
if (Input.GetKeyUp(Input.KeyCode.Equals))
{
if (fullClip)
playFunc(fullClip);
}
else if (Input.GetKeyUp(Input.KeyCode.Alpha1))
{
if (idleClip)
playFunc(idleClip);
}
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
{
if (runClip)
playFunc(runClip);
}
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
{
if (pickUpClip)
playFunc(pickUpClip);
}
}

View File

@ -29,6 +29,17 @@ namespace SHADE
/// </summary>
public value struct AnimationClipAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationClip is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationClipAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -57,16 +68,6 @@ namespace SHADE
/// <param name="AnimationClipId">AssetID to the AnimationClip asset.</param>
AnimationClipAsset(AssetID AnimationClipId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationClip is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationClipAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary>
public value struct AnimationControllerAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationController is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationControllerAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="AnimationControllerId">AssetID to the AnimationController asset.</param>
AnimationControllerAsset(AssetID AnimationControllerId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationController is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationControllerAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary>
public value struct AnimationRigAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationRig is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationRigAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="AnimationRigId">AssetID to the AnimationRig asset.</param>
AnimationRigAsset(AssetID AnimationRigId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a AnimationRig is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(AnimationRigAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary>
public value struct FontAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Font is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(FontAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="fontId">AssetID to the font asset.</param>
FontAsset(AssetID fontId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Font is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(FontAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary>
public value struct MaterialAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Material is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(MaterialAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="MaterialId">AssetID to the Material asset.</param>
MaterialAsset(AssetID MaterialId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Material is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(MaterialAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary>
public value struct MeshAsset
{
public:
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Mesh is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(MeshAsset asset);
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="meshId">AssetID to the Mesh asset.</param>
MeshAsset(AssetID meshId);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Implicit conversion operator to enable checking if a Mesh is valid.
/// </summary>
/// <param name="gameObj">Asset to check.</param>
/// <returns>True if the Asset is valid.</returns>
static operator bool(MeshAsset asset);
/*-----------------------------------------------------------------------------*/
/* Conversion Operators */
/*-----------------------------------------------------------------------------*/