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

This commit is contained in:
Kah Wei 2023-03-10 14:11:59 +08:00
parent 0fb6927342
commit 089eb9de26
7 changed files with 76 additions and 66 deletions

View File

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

View File

@ -29,6 +29,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct AnimationClipAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -57,16 +68,6 @@ namespace SHADE
/// <param name="AnimationClipId">AssetID to the AnimationClip asset.</param> /// <param name="AnimationClipId">AssetID to the AnimationClip asset.</param>
AnimationClipAsset(AssetID AnimationClipId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct AnimationControllerAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="AnimationControllerId">AssetID to the AnimationController asset.</param> /// <param name="AnimationControllerId">AssetID to the AnimationController asset.</param>
AnimationControllerAsset(AssetID AnimationControllerId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct AnimationRigAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="AnimationRigId">AssetID to the AnimationRig asset.</param> /// <param name="AnimationRigId">AssetID to the AnimationRig asset.</param>
AnimationRigAsset(AssetID AnimationRigId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct FontAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="fontId">AssetID to the font asset.</param> /// <param name="fontId">AssetID to the font asset.</param>
FontAsset(AssetID fontId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct MaterialAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="MaterialId">AssetID to the Material asset.</param> /// <param name="MaterialId">AssetID to the Material asset.</param>
MaterialAsset(AssetID MaterialId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,6 +28,17 @@ namespace SHADE
/// </summary> /// </summary>
public value struct MeshAsset 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
@ -56,16 +67,6 @@ namespace SHADE
/// <param name="meshId">AssetID to the Mesh asset.</param> /// <param name="meshId">AssetID to the Mesh asset.</param>
MeshAsset(AssetID meshId); 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 */ /* Conversion Operators */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/