예제 #1
0
    // Pushes this entity back!
    protected virtual void Knockback(DamageData data, Vector3 forward)
    {
        if (dead)
        {
            return;
        }

        Vector3 dir = data.GetForce() * forward;

        rb.AddForce(dir, ForceMode.Impulse);

        Debug.DrawRay(rb.position, dir, Color.green, 1f); // For visual purposes

        Hitstun(data.GetHitstun());                       // Makes the entity stunned by the hit
    }