Esempio n. 1
0
    //kill this object
    protected void Die()
    {
        //remove self from list
        Transform    dad = transform.parent;
        ChildrenList cl  = dad.GetComponent <ChildrenList>();

        cl.RemoveFromList(this);

        //if that list becomes empty, our commander should die
        if (cl.Count == 0)
        {
            dad.GetComponent <UnitController>().Die();
        }

        //destroy instance
        Destroy(gameObject);
    }
Esempio n. 2
0
 // Used by a UnitController to remove itself from our
 // children list.
 public void RemoveFromList(Component comp)
 {
     // Increment because we lost our current unit.
     _children.RemoveFromList(comp);
 }