public static void SelectObject(Animatable obj) { if (SelectedObject != null) { SelectedObject.Deselected(); } obj.Selected(); }
private void EvaluateSelectToggle(PubSubListenerEvent e) { BoxSelectionSprite.color = SelectedColor; SelectableSprite incomingSprite; if (e.value != null) { incomingSprite = (SelectableSprite)e.value; } else { incomingSprite = SelectedObject; } if (!incomingSprite) { return; } if (incomingSprite == SelectedObject) { isSelected = !isSelected; } else { isSelected = true; if (SelectedObject) { SelectedObject.Deselected(); } } SelectedObject = incomingSprite; if (!isSelected) { Debug.Log("Deselect " + SelectedObject); BoxSelectionSprite.enabled = false; SelectedObject.Deselected(); SelectedObject = null; } else { Debug.Log("Select " + SelectedObject); BoxSelectionSprite.transform.position = incomingSprite.transform.position; SelectedObject.Selected(); BoxSelectionSprite.enabled = true; } }