Example #1
0
 void Start()
 {
     if (InteractableParent == null)
     {
         InteractableParent = gameObject.GetComponentInParent <UseSelectable>();
     }
 }
Example #2
0
 public void OnClicked(UseSelectable interactable)
 {
     // Cannot click on something else when build picker is open
     if (GetComponent <PanelStateHandler>().BuildPicker.activeInHierarchy)
     {
         return;
     }
     if (consistencyHandler.CurrentInteractorSelection == null)
     {
         // We can't select an interactable if the interactor is not active
         consistencyHandler.SetDirty();
         return;
     }
     if (consistencyHandler.CurrentInteractableSelection != null)
     {
         consistencyHandler.CurrentInteractableSelection.TriggerUnselection();
         if (consistencyHandler.CurrentInteractableSelection == interactable)
         {
             // We clicked on the same interactable twice, remove it and leave
             consistencyHandler.CurrentInteractableSelection = null;
             consistencyHandler.SetDirty();
             return;
         }
     }
     interactable.TriggerSelection();
     consistencyHandler.CurrentInteractableSelection = interactable;
     consistencyHandler.SetDirty();
 }
Example #3
0
 // When an interactor dies, we check if we have some broken state or not in the panel
 public void OnInteractorDeath(Interactor interactor)
 {
     if (CurrentInteractorSelection == interactor)
     {
         CurrentInteractorSelection   = null;
         CurrentInteractableSelection = null;
         SetDirty();
     }
 }