Exemple #1
0
    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);
        }
    }
Exemple #2
0
 public void DestroySelectorItem(SelectorItem selectorItem)
 {
     TryRemoveFromList(selectorItem.InteractiveObject, selectorItemsAimMenu);
     TryRemoveFromList(selectorItem.InteractiveObject, selectorItemsNoPoseMenu);
     if (selectorItem.IsSelected())
     {
         DeselectObject(true);
     }
     if (selectorItem.InteractiveObject is ISubItem subItem)
     {
         InteractiveObject parentObject = subItem.GetParentObject();
         if (parentObject != null)
         {
             if (SelectorItems.TryGetValue(parentObject.GetId(), out SelectorItem parentSelectorItem))
             {
                 parentSelectorItem.RemoveChild(selectorItem);
             }
         }
     }
     if (selectorItem != null && selectorItem.gameObject != null)
     {
         Destroy(selectorItem.gameObject);
     }
     SelectorItems.Remove(selectorItem.InteractiveObject.GetId());
 }