// Animancer // Copyright 2020 Kybernetik // #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value. using UnityEngine; namespace Animancer.Examples.StateMachines.Platformer { /// /// Base class for the various states a can be in and actions they can perform. /// [HelpURL(Strings.APIDocumentationURL + ".Examples.StateMachines.Platformer/CreatureState")] public abstract class CreatureState : FSM.StateBehaviour, FSM.IOwnedState { /************************************************************************************************************************/ [SerializeField] private Creature _Creature; /// The that owns this state. public Creature Creature { get { return _Creature; } } /// /// Sets the . /// /// /// This is not a property setter because you shouldn't be casually changing the owner of a state. Usually this /// would only be used when adding a state to a creature using a script. /// public void SetCreature(Creature creature) { _Creature = creature; } /************************************************************************************************************************/ /// /// The current speed at which this state allows the creature to move. /// /// /// This value is always 0 unless overridden by a child class. /// public virtual float MovementSpeed { get { return 0; } } /************************************************************************************************************************/ public FSM.StateMachine OwnerStateMachine { get { return _Creature.StateMachine; } } /************************************************************************************************************************/ } }