public void SetSelectedObject(SelectorItem selectorItem, bool manually = false, bool enableRequestingObject = true) { if (manually && requestingObject && enableRequestingObject) { GameManager.Instance.ObjectSelected(selectorItem.InteractiveObject); } else { if (manually) { if (selectorItem.IsSelected() && ManuallySelected) { selectorItem.SetSelected(false, manually); ManuallySelected = false; SelectedObjectChanged(null); return; } } if (!selectorItem.IsSelected()) { DeselectObject(manually); } if (manually) { ManuallySelected = true; } selectorItem.SetSelected(true, manually); SelectedObjectChanged(selectorItem, ManuallySelected); } }
public void DeselectObject(bool manually = true) { if (manually) { ManuallySelected = false; } if (lastSelectedItem != null) { lastSelectedItem.SetSelected(false, manually); SelectedObjectChanged(null); } /*foreach (SelectorItem item in selectorItems.Values.ToList()) { * item.SetSelected(false, manually); * }*/ }