コード例 #1
0
ファイル: Entity.cs プロジェクト: hadiDanial/Moonstruck
 internal virtual void Move()
 {
     isGrounded = _isGrounded;
     if (IsActive())
     {
         jumpTimeElapsed = isGrounded ? jumpGracePeriod : jumpTimeElapsed - Time.deltaTime;
         gravityObj.SetRigidbodyGravity((isGrounded && !hasJumped) || (isGrounded && isCollided) ? GravityState.GroundedGravity : gravityObj.GetGravityState());
         //rb.gravityScale = (isGrounded && !hasJumped) || (isGrounded && isCollided) ? 0 : gravityObj.GetCurrentGravity();
         if (input != Vector2.zero)
         {
             currentMovementMultiplier = isGrounded ? 1 : airControlPercent;
             rb.AddForce(movementVector * totalSpeedMultiplier * Time.deltaTime, ForceMode2D.Force);
         }
         else
         {
             rb.AddForce(-rb.velocity.x * Vector2.right * totalSpeedMultiplier * stoppingPower * Time.deltaTime);
         }
     }
 }