Esempio n. 1
0
    private void DestroyObject()
    {
        if (totalArmor <= 0)
        {
            switch (parent)
            {
            case Parent.Rocket: {
                RocketScript rocket = gameObject.GetComponent <RocketScript>();
                if (rocket != null && rocket.allowTriggers)
                {
                    rocket.CustomDestroy();
                }
            } break;

            case Parent.Asteroid: {
                Asteroid asteroid = gameObject.GetComponent <Asteroid>();
                if (asteroid != null)
                {
                    asteroid.CustomDestroy();
                }
            } break;

            case Parent.Ship: {
                ShipScript ship = gameObject.GetComponent <ShipScript>();
                if (ship != null)
                {
                    ship.CustomDestroy();
                }
            } break;
            }
        }
    }