Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Enemies e = other.GetComponent <Enemies>();

        // we can safely assume that an object is an enemy if it contains the Enemy.cs component.
        if (e)
        {
            e.Die();
            ExplosionManager.instance.SpawnExplosionAt(transform.position, 0.2f);    // explosion without reward
            Destroy(this.gameObject);
        }
    }