void ContinueOrEnterCharacterState(PlayerCharacterState.ECharacterState eState, PlayerCharacterState.ECharacterFacing eFacing) { if (eState != m_CharacterState.CharacterState || eFacing != m_eFacing) { EnterFacing(eFacing); EnterCharacterState(eState); } }
public void EnterCharacterState(PlayerCharacterState.ECharacterState eState) { if (!m_Animator2D) { return; } if (m_CharacterState != null) { m_CharacterState.OnExit(); } switch (eState) { case PlayerCharacterState.ECharacterState.Stationary: { m_CharacterState = m_StationaryState; } break; case PlayerCharacterState.ECharacterState.Run: { m_CharacterState = m_RunState; } break; case PlayerCharacterState.ECharacterState.JumpUp: { //WHY DOESN'T THIS WORK m_v3Velocity.y = m_fJumpVelocity; m_CharacterState = m_JumpUpState; } break; case PlayerCharacterState.ECharacterState.FallDown: { m_CharacterState = m_FallDownState; } break; } m_CharacterState.OnEnter(); //Play the current animation associated with this state if (!string.IsNullOrEmpty(m_CharacterState.AnimationName)) { m_Animator2D.Play(m_CharacterState.AnimationName); } }