void FixedUpdate()
 {
     // Keep the playerMovement script's isGrounded bool in sync with this script's groundedState bool.
     if (groundedState != playerMovement.GetIsGrounded())
     {
         playerMovement.SetIsGrounded(groundedState);
     }
 }
示例#2
0
    void Update()
    {
        if (rjBlast_TimeSinceLastJump < rjBlast_CoolDownTime)
        {
            rjBlast_TimeSinceLastJump = Mathf.Clamp(rjBlast_TimeSinceLastJump += 1.0f * Time.deltaTime, 0.0f, rjBlast_CoolDownTime);
        }

        // Inputs
        if (Input.GetButtonDown("Fire2") && rjBlast_TimeSinceLastJump == rjBlast_CoolDownTime)
        {
            RocketJumpCheck();
        }
        if (Input.GetButton("Crouch") && !playerMovement.GetIsGrounded())
        {
            AccelerateDown();
        }
    }
 void Awake()
 {
     playerMovement = transform.parent.GetComponent <Player_Movement>();
     groundedState  = playerMovement.GetIsGrounded();
 }