示例#1
0
        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;
        }
示例#2
0
        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);
        }
示例#3
0
 private void CallOnTriggersWithGuardConditionsChangedEvent(TriggerWithGuardConditions triggerWithGuardConditions)
 {
     OnTriggersWithGuardConditionsChanged?.Invoke(this);
 }