Esempio n. 1
0
 void ForceForJump()
 {
     if (_lockJump)
     {
         return;
     }
     if (!_player.isJump)
     {
         return;
     }
     // when jumping, the gravity value is not zero
     _rb.gravityScale = _player.gravity;
     if (!_isOnGround && _extraJump > 0)
     {
         ControlLock.ReleaseLock("Move");
         StateHandling.Handle("KickDown", "Off");
         _rb.velocity = new Vector2(_rb.velocity.x, jumpForce);
         _extraJump--;
     }
     else if (_extraJump <= 0 && _jumpByWall)
     {
         _rb.velocity = new Vector2(_rb.velocity.x, jumpForce); //Vector2.up * jumpForce;
     }
     else if (_isOnGround)
     {
         ControlLock.ReleaseLock("Move");
         _anim.SetBool("isKickDown", false);
         _rb.velocity = new Vector2(_rb.velocity.x, jumpForce); //Vector2.up * jumpForce;
     }
 }
Esempio n. 2
0
 public override void Update()
 {
     base.Update();
     if ((_anim.GetBool("isWallSliding") || _anim.GetBool("isOnGround")) && !_isDashing)
     {
         _isInCooldown = false;
     }
     if (!_isDashing && !_isInCooldown)
     {
         if (Input.GetKeyDown(KeyCode.L))
         {
             StateHandling.Handle("KickDown", "Off");
             StartCoroutine(StartDashing());
         }
     }
 }
 public override void Update()
 {
     base.Update();
     if (_lock)
     {
         return;
     }
     if (_player.GetInputVertical() > 0)
     {
         _isPressedUp = true;
     }
     if (_player.GetInputVertical() == 0)
     {
         _isPressedUp = false;
     }
     if (_isPressedUp && Input.GetKeyDown(KeyCode.J) && !_isInCooldown)
     {
         StateHandling.Handle("KickDown", "Off");
         StartCoroutine(StartPunchUp());
     }
 }
 public override void Start()
 {
     base.Start();
     ControlLock.Register(this, "KickDown");
     StateHandling.Register(this, "KickDown");
 }