Ejemplo n.º 1
0
 public static bool IsConnected(Trigger trigger, Triggerable triggerable)
 {
     if (trigger.targets.Contains(triggerable))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        private void SelectTriggerable(Triggerable triggerable)
        {
            selectedTrigger     = null;
            selectedTriggerable = triggerable;

            selectedEditor = UnityEditor.Editor.CreateEditor(triggerable) as StratusEditor;
            selectedEditor.backgroundStyle = EditorStyles.helpBox;
        }
Ejemplo n.º 3
0
 void OnTriggered(Triggerable other)
 {
     current.Remove(other);
     if (ShouldActivate())
     {
         Activate();
     }
     Trace.Script("Elements left = " + current.Count, this);
 }
Ejemplo n.º 4
0
 private void RemoveTriggerable(Triggerable triggerable)
 {
     if (selected == triggerable)
     {
         Deselect();
         selectedTriggerable = null;
     }
     endOfFrameRequests.Add(() =>
     {
         target.triggerables.Remove(triggerable);
         Undo.DestroyObjectImmediate(triggerable);
     });
 }
Ejemplo n.º 5
0
 private void SetTriggerableContextMenu(Triggerable triggerable, GenericMenu menu)
 {
     // Connect
     if (selectedTrigger)
     {
         if (connectedTriggerables[triggerable])
         {
             menu.AddItem(new GUIContent($"Disconnect from {selectedTrigger.GetType().Name}"), false, () => Disconnect(selectedTrigger, triggerable));
         }
         else
         {
             menu.AddItem(new GUIContent($"Connect to {selectedTrigger.GetType().Name}"), false, () => Connect(selectedTrigger, triggerable));
         }
     }
 }
Ejemplo n.º 6
0
 private TriggerSystem.ConnectionStatus GetStatus(Triggerable triggerable)
 {
     TriggerSystem.ConnectionStatus status = TriggerSystem.ConnectionStatus.Disconnected;
     if (selected)
     {
         if (selected == triggerable)
         {
             status = TriggerSystem.ConnectionStatus.Selected;
         }
         else if (selectedTrigger && connectedTriggerables.ContainsKey(triggerable) && connectedTriggerables[triggerable])
         {
             status = TriggerSystem.ConnectionStatus.Connected;
         }
     }
     if (!IsConnected(triggerable) && selected != triggerable)
     {
         status = TriggerSystem.ConnectionStatus.Disjoint;
     }
     return(status);
 }
        private void DrawTriggerable(Triggerable triggerable)
        {
            TriggerSystem.ConnectionStatus status = TriggerSystem.ConnectionStatus.Disconnected;
            if (selected)
            {
                if (selected == triggerable)
                {
                    status = TriggerSystem.ConnectionStatus.Selected;
                }
                else if (selectedTrigger && connectedTriggerables.ContainsKey(triggerable) && connectedTriggerables[triggerable])
                {
                    status = TriggerSystem.ConnectionStatus.Connected;
                }
            }
            if (!IsConnected(triggerable) && selected != triggerable)
            {
                status = TriggerSystem.ConnectionStatus.Disjoint;
            }

            Color color = GetColor(triggerable, status);

            Draw(triggerable, color, SelectTriggerable, RemoveTriggerable, SetTriggerableContextMenu);
        }
Ejemplo n.º 8
0
 private bool IsConnected(Triggerable triggerable) => triggerableConnectivity.ContainsKey(triggerable) && triggerableConnectivity[triggerable] == TriggerSystem.ConnectionStatus.Connected;
Ejemplo n.º 9
0
 private bool IsConnected(Trigger trigger, Triggerable triggerable) => TriggerSystem.IsConnected(trigger, triggerable);
Ejemplo n.º 10
0
 private void Disconnect(Trigger trigger, Triggerable triggerable)
 {
     Trace.Script($"Disconnecting {trigger.GetType().Name} and {triggerable.GetType().Name}");
     trigger.targets.Remove(triggerable);
     UpdateConnections();
 }