Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        if (collisionEffect != null)
        {
            GetComponent <Destructible> ().onCollision2D += (collision) => {
                Instantiate(collisionEffect, collision.contacts[0].point, collisionEffect.transform.rotation);
            };
        }

        if (damage > 0)
        {
            GetComponent <Destructible> ().onCollision2D += (collision) => {
                Destructible other = collision.contacts[0].collider.GetComponent <Destructible> ();
                if (other != null)
                {
                    other.DealDamage(damage);
                }
            };
        }
    }