Exemple #1
0
        private void FixedUpdate()
        {
            _horizontalInput = GetHorizontalInput();

            if (AnyKeyFrom(_jumpKeys, Input.GetKey))
            {
                PlayerTryJump(_horizontalInput);
            }
            else
            {
                PlayerTryMove(_horizontalInput);
            }
        }
Exemple #2
0
 private void PlayerTryJump(HorizontalInput horizontalInput)
 {
     if (horizontalInput == HorizontalInput.None)
     {
         _player.TryJumpUp();
     }
     else if (horizontalInput == HorizontalInput.Left)
     {
         _player.TryJumpForward(false);
     }
     else
     {
         _player.TryJumpForward(true);
     }
 }
Exemple #3
0
 private void PlayerTryMove(HorizontalInput horizontalInput)
 {
     if (horizontalInput == HorizontalInput.None)
     {
         _player.TrySlowdown();
     }
     else if (horizontalInput == HorizontalInput.Left)
     {
         _player.TryMoveForward(false);
     }
     else
     {
         _player.TryMoveForward(true);
     }
 }