public TransitionConnection(StateNode source, StateNode target, Type triggerType, Dictionary <object, ScriptableGuardCondition[]> triggersWithGuardConditions = null) { Source = source; Target = target; _triggerType = triggerType; if (triggersWithGuardConditions != null) { foreach (var triggerWithGuardConditions in triggersWithGuardConditions) { var t = new TriggerWithGuardConditions(_triggerType, triggerWithGuardConditions.Key, triggerWithGuardConditions.Value); t.OnTriggerChanged += CallOnTriggersWithGuardConditionsChangedEvent; t.OnGuardConditionsChanged += CallOnTriggersWithGuardConditionsChangedEvent; _triggersWithGuardConditionsList.Add(t); } } _controlsAreaStyle = new GUIStyle(); _controlsAreaStyle.padding = new RectOffset(ControlPaddingLeft, ControlPaddingRight, ControlPaddingTop, ControlPaddingBottom); _simpleLabelStyle = new GUIStyle(); _simpleLabelStyle.wordWrap = true; _currentColor = NormalColor; }
private List <TriggerWithGuardConditions> ResizeList(List <TriggerWithGuardConditions> list, int size) { List <TriggerWithGuardConditions> newList = new List <TriggerWithGuardConditions>(); for (var i = 0; i < size; i++) { if (i < list.Count) { newList.Add(list[i]); } else { var t = new TriggerWithGuardConditions(_triggerType); t.OnTriggerChanged += CallOnTriggersWithGuardConditionsChangedEvent; t.OnGuardConditionsChanged += CallOnTriggersWithGuardConditionsChangedEvent; newList.Add(t); } } return(newList); }
private void CallOnTriggersWithGuardConditionsChangedEvent(TriggerWithGuardConditions triggerWithGuardConditions) { OnTriggersWithGuardConditionsChanged?.Invoke(this); }