Пример #1
0
    private void fire(RaycastHit hit)
    {
        // If we have a Rigidbody, apply an explosive force to it
        if (hit.rigidbody)
        {
            hit.rigidbody.AddExplosionForce(power, transform.position, radius);
        }

        // Call the target's onFire function
        Lockable l = (Lockable)hit.transform.GetComponents(typeof(Lockable))[0];

        l.onFire();
    }
Пример #2
0
    private void fire(Transform t)
    {
        // If we have a Rigidbody, apply an explosive force to it
        if (t.rigidbody)
        {
            t.rigidbody.AddExplosionForce(power, transform.position - new Vector3(0, 1, 0), radius);
        }

        // Call the target's onFire function
        Lockable l = (Lockable)t.GetComponents(typeof(Lockable))[0];

        l.onFire();

        // Sounds
        gameMaster.onFire();
    }