Example #1
0
    private void Bounce(Vector2 originalVelocity)
    {
        Bouncer bouncer = this.GetBouncerCollider();

        if (bouncer != null)
        {
            float   bounceForce = bouncer.BounceForce();
            Vector2 normal      = this.GetFloorNormal();
            float   strength    = Math.Min(originalVelocity.Length() * bounceForce, JumpForce * 1.5f);
            this.Velocity = (normal - originalVelocity.Normalized()).Normalized() * strength;;
            this.JumpSound.Play();
        }
    }