private void HandleSteerAndFalling() { Vector3 moveVel = Vector3.zero; if (Input.GetKey(KeyCode.RightArrow)) { moveVel += m_Player.GetSteerRightMovementStep(); m_Player.FaceRightDirection(); } else if (Input.GetKey(KeyCode.LeftArrow)) { moveVel += m_Player.GetSteerLeftMovementStep(); m_Player.FaceLeftDirection(); } else { m_Player.InitSteerMovement(); } //Add fall movement to the steer movement moveVel += m_Player.GetFallMovementStep(); m_Player.transform.localPosition += moveVel * Time.deltaTime; Vector3 pos = m_Player.transform.position; m_FallingCamera.ClampPositionToScreen(ref pos); m_Player.transform.position = pos; m_Player.ResolveCollisions(); }
private void HandleFallMovement() { Vector3 moveVel = Vector3.zero; //We fall in this state too. Let's do the movement first... moveVel += m_Player.GetFallMovementStep(); m_Player.transform.localPosition += moveVel * Time.deltaTime; Vector3 pos = m_Player.transform.position; m_FallingCamera.ClampPositionToScreen(ref pos); m_Player.transform.position = pos; }