public static void updateSelection(List <WorldObject> currSelect) { currentlySelected.Clear(); //clear current selection unitTray.clearSelectedObjectTray(); if (currSelect == null || currSelect.Count == 0) //deselect //nothing is selected //display nothing selected stuff { HUDPortraitName.GetComponent <UnityEngine.UI.Text>().text = null; HUDPortraitImage.sprite = null; } else { currentlySelected.Add(currSelect[0].gameObject); WorldObject currSelectWorldObject = currentlySelected[0].GetComponent <WorldObject>(); HUDPortraitName.GetComponent <UnityEngine.UI.Text>().text = currSelectWorldObject.objectName; HUDPortraitImage.sprite = currSelectWorldObject.buildImage; } foreach (WorldObject obj in currSelect) { unitTray.addToSelectionTray(obj.gameObject); } unitTray.createTray(); }
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); }