コード例 #1
0
    private void Update()
    {
        if (myPlayerInput.isPlayer)
        {
            movementSpeed = playerStats.movespeed;
            jumpSpeed     = playerStats.jumpSpeed;
        }
        if (myPlayerInput.isBear)
        {
            movementSpeed = bearStats.movespeed;
            jumpSpeed     = bearStats.jumpSpeed;
        }
        if (myPlayerInput.isWolf)
        {
            movementSpeed = wolfStat.movespeed;
            jumpSpeed     = wolfStat.jumpSpeed;
        }
        if (myPlayerInput.isRabbit)
        {
            movementSpeed = rabbitStat.movespeed;
            jumpSpeed     = rabbitStat.jumpSpeed;
        }

        if (characterController.isGrounded)
        {
            if (moveDirection.magnitude > 0 && isFinishedJumping)//
            {
                var animationSpeedMultiplier = agentAnimations.SetCorrectAnimation(desiredRotationAngle, angleThreshold, inputVerticalDirection);;

                if (tempMovementTriggered == false)
                {
                    RotateAgent();
                }
                else
                {
                    RotateTemp();
                }

                moveDirection *= animationSpeedMultiplier;
            }
            if (moveDirection.magnitude > 0)
            {
                agentAnimations.standing = false;
                agentAnimations.TriggerStandAnimation();
            }
        }

        moveDirection.y -= gravity;

        if (isJumping)
        {
            isJumping         = false;
            isFinishedJumping = false;
            moveDirection.y   = jumpSpeed;
            agentAnimations.SetMovementFloat(0);
            agentAnimations.TriggerJumpAnimation();
        }

        characterController.Move(moveDirection * Time.deltaTime);
    }
コード例 #2
0
 private void GetJumpInput()
 {
     if (Input.GetAxisRaw("Jump") > 0 && canJump)//
     {
         OnJump?.Invoke();
     }
     //AA code
     // for bear
     if (Input.GetAxisRaw("Jump") > 0 && canJump == false)
     {
         myAnimations.standing = true;
         myAnimations.TriggerStandAnimation();
     }
 }