2024-06-23 19:12:22 +01:00

50 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MBT
{
// TODO: This should be GameObject
[AddComponentMenu("")]
public class GameObjectVariable : Variable<GameObject>
{
protected override bool ValueEquals(GameObject val1, GameObject val2)
{
return val1 == val2;
}
}
[System.Serializable]
public class GameObjectReference : VariableReference<GameObjectVariable, GameObject>
{
public GameObjectReference(VarRefMode mode = VarRefMode.EnableConstant)
{
SetMode(mode);
}
protected override bool isConstantValid
{
get { return constantValue != null; }
}
public GameObject Value
{
get
{
return (useConstant)? constantValue : this.GetVariable().Value;
}
set
{
if (useConstant)
{
constantValue = value;
}
else
{
this.GetVariable().Value = value;
}
}
}
}
}