Example #1
0
    /*
     * Performs a vault to the height of the ledge in front of the player
     */
    private IEnumerator PerformVault()
    {
        vaulting = true;

        while (PlayerCollisionController.GetVaultHeight() > 0f)
        {
            // Get the force required to move the player up to the level of the ledge
            float force = Mathf.Sqrt(PlayerCollisionController.GetVaultHeight() * -2 *
                                     -GlobalGravityControl.GetGravityStrength());

            rb.velocity = transform.up * force;
            yield return(0);
        }

        vaulting = false;
    }
Example #2
0
 // Update current gravity direction and strength
 void UpdateGravityValues()
 {
     currentGravityStrength = GlobalGravityControl.GetGravityStrength() * gravityModifier;
     currentGravityVector   = GlobalGravityControl.GetCurrentGravityVector();
 }