コード例 #1
0
 public static bool IsConnected(Trigger trigger, Triggerable triggerable)
 {
     if (trigger.targets.Contains(triggerable))
     {
         return(true);
     }
     return(false);
 }
コード例 #2
0
        private void SelectTriggerable(Triggerable triggerable)
        {
            selectedTrigger     = null;
            selectedTriggerable = triggerable;

            selectedEditor = UnityEditor.Editor.CreateEditor(triggerable) as StratusEditor;
            selectedEditor.backgroundStyle = EditorStyles.helpBox;
        }
コード例 #3
0
 void OnTriggered(Triggerable other)
 {
     current.Remove(other);
     if (ShouldActivate())
     {
         Activate();
     }
     Trace.Script("Elements left = " + current.Count, this);
 }
コード例 #4
0
 private void RemoveTriggerable(Triggerable triggerable)
 {
     if (selected == triggerable)
     {
         Deselect();
         selectedTriggerable = null;
     }
     endOfFrameRequests.Add(() =>
     {
         target.triggerables.Remove(triggerable);
         Undo.DestroyObjectImmediate(triggerable);
     });
 }
コード例 #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));
         }
     }
 }
コード例 #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);
 }
コード例 #7
0
        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);
        }
コード例 #8
0
 private bool IsConnected(Triggerable triggerable) => triggerableConnectivity.ContainsKey(triggerable) && triggerableConnectivity[triggerable] == TriggerSystem.ConnectionStatus.Connected;
コード例 #9
0
 private bool IsConnected(Trigger trigger, Triggerable triggerable) => TriggerSystem.IsConnected(trigger, triggerable);
コード例 #10
0
 private void Disconnect(Trigger trigger, Triggerable triggerable)
 {
     Trace.Script($"Disconnecting {trigger.GetType().Name} and {triggerable.GetType().Name}");
     trigger.targets.Remove(triggerable);
     UpdateConnections();
 }