Exemplo n.º 1
0
    //called when the object is destroyed
    void OnDestroy()
    {
        InvaderSetUp invSet;

        try{
            //when an invader is destroyed, remove one from the total number of invaders
            invSet = GameObject.Find("Space Invader Start").GetComponent("InvaderSetUp") as InvaderSetUp;
            invSet.setNoOfInvaders(-1);
        }catch (NullReferenceException ex) {
            //used to avoid initial errors
        }
    }