using System; using UnityEngine; using UnityAtoms.BaseAtoms; namespace UnityAtoms.FSM { public class FiniteStateMachineReferenceUsage { public const int MACHINE = 0; public const int MACHINE_INSTANCER = 1; } /// /// Reference of type `FiniteStateMachine`. Inherits from `AtomBaseReference`. /// [Serializable] public class FiniteStateMachineReference : AtomBaseReference { /// /// Get the value for the Reference. /// /// The value of type `FiniteStateMachine`. public FiniteStateMachine Machine { get { switch (_usage) { case (FiniteStateMachineReferenceUsage.MACHINE_INSTANCER): return _machineInstancer == null ? default(FiniteStateMachine) : _machineInstancer.Variable; case (FiniteStateMachineReferenceUsage.MACHINE): default: return _machine; } } } /// /// Variable used if `Usage` is set to `Variable`. /// [SerializeField] private FiniteStateMachine _machine = default(FiniteStateMachine); /// /// Variable Instancer used if `Usage` is set to `VariableInstancer`. /// [SerializeField] private FiniteStateMachineInstancer _machineInstancer = default(FiniteStateMachineInstancer); } }