private void DeselectTarget() { if (SelectedObject == null) { return; } // Cleanup selectedHitBoxHandler.ToggleSelectionSprite(false); stabilityAssistUI.SetActive(false); // Deselect if anything selected selectedShip = null; selectedHitBoxHandler = null; SelectedObject = null; OnObjectSelectionEvent(SelectedObject); }
private void SelectTarget(ISelectable selectable) { // Deselect current DeselectTarget(); SelectedObject = selectable.GetRootObject(); selectedHitBoxHandler = selectable.GetHitBoxHandler(); selectedHitBoxHandler.ToggleSelectionSprite(true); OnObjectSelectionEvent(SelectedObject); selectedShip = SelectedObject.GetComponent <Ship>(); // Null if not ship if (selectedShip != null) { stabilityAssistDropdown.value = (int)selectedShip.StabilityAssistMode; stabilityAssistUI.SetActive(selectedShip.StabilityAssistEnabled); } Debug.LogFormat("Selected {0}", SelectedObject.name); }