Beispiel #1
0
 public void EnterState(PhysicsStateType stateType)
 {
     if (_psmStates.ContainsKey(stateType))
     {
         AbstractPSMState nextState = _psmStates[stateType];
         EnterState(nextState);
     }
 }
Beispiel #2
0
 void EnterState(AbstractPSMState nextState)
 {
     if (nextState == null)
     {
         return;
     }
     if (currentState != null)
     {
         currentState.ExitState();
     }
     currentState = nextState;
     InitializeState(nextState);
     currentState.EnterState();
 }
Beispiel #3
0
 public void Awake()
 {
     animator = this.GetComponentInChildren <Animator>();
     if (animator != null)
     {
         Debug.LogWarning("No Animator is present");
     }
     Cursor.lockState = CursorLockMode.Locked;
     input            = this.GetComponent <Abstract_Input_Handler>();
     currentState     = null;
     rigidbody        = this.GetComponent <Rigidbody>();
     _psmStates       = new Dictionary <PhysicsStateType, AbstractPSMState>();
     foreach (AbstractPSMState state in _validStates)
     {
         InitializeState(state);
         _psmStates.Add(state.StateType, state);
     }
 }
Beispiel #4
0
 //manage sate entering
 #region STATE MANAGEMENT
 void InitializeState(AbstractPSMState state)
 {
     state.InitializeState(animator, input, this, movement, rigidbody);
 }