Beispiel #1
0
    public void deselectAll()
    {
        //make clauses for all types of units, as they might have deslection animations, menus to close, etc

        foreach (var battalion in GetComponentsInChildren <Battalion>())          //get all selectable objects in children of player
        {
            battalion.Deselect();
        }

        foreach (Buildings Building in GetComponentsInChildren <Buildings>())
        {
            Building.closeMenu();
            Destroy(Building.GetComponent <SelectableObject>().selectionCircle);
        }

        commanderInput.updateSelectedObjects((WorldObject)null);
    }
    public void TaskOnClick()
    {
        parentTray.clearSelectedObjectTray();           //clear selection tray
        BattalionSelectionComponent unitSelectObj = FindObjectOfType <BattalionSelectionComponent>();

        unitSelectObj.deselectAll();                                                      //deselect all units
        unitSelectObj.createCircle(representingObject.GetComponent <SelectableObject>()); //add circle to unit
        commanderInput.updateSelectedObjects(representingObject);
    }