JetState

JetState is the base class extended by MovingState, JumpState, DashState, and more.

Public Methods

public void ForceBegin()

Forces the JetState to begin, whether or not CanInitiate() returns True.

public void Begin(bool canInterruptSelf = false)

Begins the State, but only if CanInitiate() returns True; canInterruptSelf governs whether this state can Begin() again even while it’s already the currentState.

public void End()

Ends the current state and its movements.

public virtual void UpdateMovement()

Overidden by each state; called automatically every FixedUpdate by JetController. Handles the movement associated with the state.

public bool IsTurnAnimationOverriding()

Checks to see if a Turn animation is playing, and if that should override this state’s animation.

public virtual bool CanInitiate()

Can be overidden by each state to determine what circumstances the state can be initiated from.

public bool IsFrozen()

Returns True if the game is paused or contact delay is happening; used primarily to see if we should accept inputs.

public virtual void OnBegin()

Called automatically when Begin() is successfully called. This can be overidden for each individual movement.

public void PlayAnimation()

This will play the primary animation slotted into this JetState in the Inspector. Called automatically by JetController when the JetState is initiated.

public virtual void OnEnded()

This is called when the state ends; note that states can continue updating even if another state takes priority, so OnEnded won’t necessarily be called just because the state changes.

public virtual void OnStateChanged()

This is called when the attached JetController’s currentState changes, whether or not the previous state has ended.

Public Members

public string id

The unique id of a state; should be set in Awake, and should be unique for each state.

public bool hasEnded

Whether or not the state has ended its current movements.

public bool isEnabled

If False, this state will not be updated.

public AnimationClip animation

The AnimationClip that plays when this state is entered.

public AudioClip audioClip

The AudioClip that plays when this state is entered.

public bool willPlayAnimationOnBegin

If False, you must manually play the animation for this state, rather than it auto-starting when the state begins.

public bool isKnockbackEnabled

If knockback can affect the JetController from this state.

public bool willAllowDirectionChange

If changing directions is allowed in this state.

public bool isConcurrent

If True, this state will be updated in the background even if it isn’t the currentState of the JetController; if False, it will not be updated unless it IS currentState of the JetController.

public JetController controller

A reference to the JetController that handles and updates this state.