using System; using UnityEngine; using UnityAtoms.BaseAtoms; namespace UnityAtoms.FSM { public class FiniteStateMachineReferenceUsage { public const int FSM = 0; public const int FSM_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.FSM_INSTANCER): return _fsmInstancer == null ? default(FiniteStateMachine) : (FiniteStateMachine)_fsmInstancer.Variable; case (FiniteStateMachineReferenceUsage.FSM): default: return _fsm; } } } /// /// Variable used if `Usage` is set to `FSM`. /// [SerializeField] private FiniteStateMachine _fsm = default(FiniteStateMachine); /// /// Variable Instancer used if `Usage` is set to `FSM_INSTANCER`. /// [SerializeField] private FiniteStateMachineInstancer _fsmInstancer = default(FiniteStateMachineInstancer); } }