public PlayerState(IEventManager playerEvent) { #region Player State Initialization _StateIdle = new IdleState(this); _StateWalk = new WalkState(this); _StateSprint = new SprintState(this); _StateFall = new FallState(this); _StateCrouch = new CrouchState(this); _StateJump = new JumpState(this); _StateCrouchWalk = new CrouchWalkState(this); _StateSlide = new SlideState(this); _StateCrouchJump = new CrouchJumpState(this); _StateCrouchFall = new CrouchFallState(this); _StateAirMoveCrouchFall = new AirMoveCrouchFallState(this); _StateAirMoveCrouchJump = new AirMoveCrouchJumpState(this); _StateAirMoveFall = new AirMoveFallState(this); _StateAirMoveJump = new AirMoveJumpState(this); #endregion _ActiveProxies = new HashSet <IDynamicProxy>(); _EventPlayer = playerEvent; _CurrentPlayerState = _StateIdle; #region State Proxy Initialization _MediatorToggleProxy = new ToggleProxyMediator(); _ProxySprint = new SprintProxy(this, _MediatorToggleProxy); _ProxyCrouch = new CrouchProxy(this, _MediatorToggleProxy); _MediatorToggleProxy.ProxyCrouch = _ProxyCrouch; _MediatorToggleProxy.ProxySprint = _ProxySprint; _ProxyWalk = new WalkProxy(this, _MediatorToggleProxy); _ProxyFall = new FallProxy(this); _ProxyJump = new JumpProxy(this, _MediatorToggleProxy); #endregion }
public void TransferToState(APlayerState state) { // Debug.Log("Exiting: " + currentState); // Debug.Log("Entering: " + state); currentState.OnExit(this); currentState = state; currentState.OnEnter(this); }
public void ChangeState(APlayerState newState) { _CurrentPlayerState = newState; _CurrentPlayerState.ExecuteStateEvent(_EventPlayer); }
public PlayerState(APlayerState ps, GameObject gameO) { State = ps; GO = gameO; }