Advertisement
LeeMace

State

May 2nd, 2024
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | Gaming | 0 0
  1. using UnityEngine;
  2.  
  3. public abstract class State
  4. {
  5.     protected StateMachine stateMachine;
  6.  
  7.     protected AppManager appManager => stateMachine.appManager;
  8.  
  9.     public State(StateMachine stateMachine) {
  10.         this.stateMachine = stateMachine;
  11.     }
  12.  
  13.     public void Enter() {
  14.         EnterState();
  15.     }
  16.  
  17.     protected virtual void EnterState() {
  18.    
  19.     }
  20.  
  21.     protected virtual void ExitState(State nextState) {
  22.  
  23.         stateMachine.SetState(nextState);
  24.     }
  25.  
  26.     public virtual void UpdateState() {
  27.    
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement