feat(scripting): add mono csharp runtime foundation
This commit is contained in:
@@ -6,6 +6,14 @@ namespace Gameplay
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class UnsupportedManagedComponent : Component
|
||||
{
|
||||
private UnsupportedManagedComponent(ulong gameObjectUUID)
|
||||
: base(gameObjectUUID)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class LifecycleProbe : MonoBehaviour
|
||||
{
|
||||
public int AwakeCount;
|
||||
@@ -18,14 +26,47 @@ namespace Gameplay
|
||||
public int DestroyCount;
|
||||
|
||||
public float Speed;
|
||||
public float ObservedFixedDeltaTime;
|
||||
public float ObservedUpdateDeltaTime;
|
||||
public float ObservedLateDeltaTime;
|
||||
public string Label = string.Empty;
|
||||
public string ObservedGameObjectName = string.Empty;
|
||||
public string ObservedTargetName = string.Empty;
|
||||
public bool WasAwakened;
|
||||
public bool WarningLogged;
|
||||
public bool ErrorLogged;
|
||||
public bool HasTransform;
|
||||
public bool TransformLookupSucceeded;
|
||||
public bool HasUnsupportedComponent;
|
||||
public bool UnsupportedComponentLookupReturnedNull;
|
||||
public bool TargetResolved;
|
||||
public bool RotationAccessed;
|
||||
public bool ScaleAccessed;
|
||||
public bool TransformAccessed;
|
||||
public bool ObservedEnabled;
|
||||
public bool ObservedActiveSelf;
|
||||
public bool ObservedActiveInHierarchy;
|
||||
public bool ObservedIsActiveAndEnabled;
|
||||
public bool DisableSelfOnFirstUpdate;
|
||||
public bool DeactivateGameObjectOnFirstUpdate;
|
||||
public GameObject Target;
|
||||
public GameObject SelfReference;
|
||||
public Vector4 ObservedLocalRotation;
|
||||
public Vector3 ObservedLocalPosition;
|
||||
public Vector3 ObservedLocalScale;
|
||||
public Vector3 SpawnPoint;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
AwakeCount += 1;
|
||||
WasAwakened = true;
|
||||
gameObject.name = gameObject.name + "_Managed";
|
||||
ObservedGameObjectName = gameObject.name;
|
||||
Debug.Log(ObservedGameObjectName);
|
||||
Debug.LogWarning(ObservedGameObjectName);
|
||||
WarningLogged = true;
|
||||
Debug.LogError(ObservedGameObjectName);
|
||||
ErrorLogged = true;
|
||||
Label = Label + "|Awake";
|
||||
}
|
||||
|
||||
@@ -37,23 +78,80 @@ namespace Gameplay
|
||||
public void Start()
|
||||
{
|
||||
StartCount += 1;
|
||||
HasTransform = HasComponent<Transform>();
|
||||
HasUnsupportedComponent = HasComponent<UnsupportedManagedComponent>();
|
||||
|
||||
SelfReference = gameObject;
|
||||
TargetResolved = Target != null;
|
||||
if (Target != null)
|
||||
{
|
||||
ObservedTargetName = Target.name;
|
||||
}
|
||||
|
||||
TransformLookupSucceeded = TryGetComponent(out Transform resolvedTransform);
|
||||
UnsupportedComponentLookupReturnedNull = !gameObject.TryGetComponent(out UnsupportedManagedComponent unsupportedComponent);
|
||||
|
||||
if (resolvedTransform != null)
|
||||
{
|
||||
resolvedTransform.localPosition = new Vector3(7.0f, 8.0f, 9.0f);
|
||||
resolvedTransform.localRotation = new Quaternion(0.0f, 0.5f, 0.0f, 0.8660254f);
|
||||
resolvedTransform.localScale = new Vector3(2.0f, 3.0f, 4.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void FixedUpdate()
|
||||
{
|
||||
FixedUpdateCount += 1;
|
||||
ObservedFixedDeltaTime = Time.deltaTime;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
UpdateCount += 1;
|
||||
Speed += 1.0f;
|
||||
ObservedUpdateDeltaTime = Time.deltaTime;
|
||||
ObservedLocalPosition = transform.localPosition;
|
||||
Quaternion rotation = transform.localRotation;
|
||||
ObservedLocalRotation = new Vector4(rotation.x, rotation.y, rotation.z, rotation.w);
|
||||
ObservedLocalScale = transform.localScale;
|
||||
ObservedEnabled = enabled;
|
||||
ObservedActiveSelf = gameObject.activeSelf;
|
||||
ObservedActiveInHierarchy = gameObject.activeInHierarchy;
|
||||
ObservedIsActiveAndEnabled = isActiveAndEnabled;
|
||||
RotationAccessed = true;
|
||||
ScaleAccessed = true;
|
||||
TransformAccessed = true;
|
||||
|
||||
if (UpdateCount == 1)
|
||||
{
|
||||
if (DisableSelfOnFirstUpdate)
|
||||
{
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
if (DeactivateGameObjectOnFirstUpdate)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LateUpdate()
|
||||
{
|
||||
LateUpdateCount += 1;
|
||||
SpawnPoint = new Vector3(SpawnPoint.X + 1.0f, SpawnPoint.Y, SpawnPoint.Z);
|
||||
ObservedLateDeltaTime = Time.deltaTime;
|
||||
|
||||
Vector3 position = transform.localPosition;
|
||||
position.x = position.x + 1.0f;
|
||||
transform.localPosition = position;
|
||||
ObservedLocalPosition = transform.localPosition;
|
||||
|
||||
Vector3 scale = transform.localScale;
|
||||
scale.x = scale.x + 1.0f;
|
||||
transform.localScale = scale;
|
||||
ObservedLocalScale = transform.localScale;
|
||||
|
||||
SpawnPoint.x = SpawnPoint.x + 1.0f;
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
|
||||
Reference in New Issue
Block a user