示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (dashPauseTimer > 0)
     {
         dashPauseTimer     -= Time.deltaTime;
         _rigidbody.velocity = Vector3.zero;
         if (dashPauseTimer <= 0)
         {
             dashPauseTimer = 0;
             _anim.StopDashSlashAnim();
         }
         return;
     }
     if (wallJumpLockTimer > 0)
     {
         wallJumpLockTimer -= Time.deltaTime;
         if (wallJumpLockTimer <= 0)
         {
             wallJumpLockTimer = 0;
             Vector3 v = _rigidbody.velocity;
             v.x *= 0.65f;
             v.y *= 0.75f;
             _rigidbody.velocity = v;
         }
         return;
     }
     isGrounded = Grounded();
     _anim.SetGrounded(isGrounded);
     if (controlsLocked || hitstun)
     {
         return;
     }
     BasicMovement();
     if (VirtualController.JumpButtonPressed())
     {
         if (UnlockTable.PowerActive(UnlockID.Jump))
         {
             Jump();
         }
     }
     else if (!_anim.IsCrouching && VirtualController.ActionButtonPressed())
     {
         if (VirtualController.GetAxisHorizontal() != 0 && UnlockTable.PowerActive(UnlockID.DashSlash))
         {
             DashSlash(PMath.GetSign(VirtualController.GetAxisHorizontal()));
         }
         else if (UnlockTable.PowerActive(UnlockID.Slash))
         {
             Slash();
         }
     }
     if (isGrounded)
     {
         numAirJumps = maxAirJumps;
     }
     UpdateCoords();
 }