예제 #1
0
    /// <summary>
    ///
    /// </summary>
    void CalculateFall()
    {
        if (JumpInmune)
        {
            JumpInmune = false; return;
        }
        if ((Time.time - fallingTime) <= 0.4f)
        {
            return;
        }

        float ver = HigherPointOnJump - m_Transform.position.y;

        if (JumpDirection == -1)
        {
            float normalized = m_Transform.position.y + Mathf.Abs(PostGroundVerticalPos);
            ver = Mathf.Abs(normalized);
        }
        if (ver > SafeFallDistance)
        {
            float damage = (ver / DeathFallDistance) * 100;
            DamageManager.GetFallDamage(damage);
        }
        //  Debug.Log(string.Format("distance: {0}", ver));
    }
예제 #2
0
 // If falling damage occured, this is the place to do something about it. You can make the player
 // have hitpoints and remove some of them based on the distance fallen, add sound effects, etc.
 void FallingDamageAlert(float fallDistance)
 {
     pdm.GetFallDamage(fallDistance * FallDamageMultipler);
     bl_EventHandler.EventFall(fallDistance * FallDamageMultipler);
 }