Exemple #1
0
 public void SetInitialChild(object childStateId)
 {
     if (ContainsChild(childStateId))
     {
         _serializedInitialChildId = GenericTypeSerializer.Serialize(childStateId);
     }
 }
 internal void SetInitialState(object stateId)
 {
     if (ContainsState(stateId))
     {
         _serializedInitialStateId = GenericTypeSerializer.Serialize(stateId);
     }
 }
Exemple #3
0
        public ParentConnectionsInfo(object parentStateId, object firstChildStateId) : this()
        {
            _stateIdTypeFullName = parentStateId.GetType().FullName;

            _serializedParentStateId = GenericTypeSerializer.Serialize(parentStateId);

            AddChild(firstChildStateId);
        }
        public StateInfo(object stateId, ScriptableState stateObject)
        {
            _serializedStateId = GenericTypeSerializer.Serialize(stateId);

            _stateIdTypeFullName = stateId.GetType().FullName;

            _stateObject = stateObject;
        }
Exemple #5
0
        public object[] GetChilds()
        {
            object[] childs = new object[_serializedChildStateIds.Count];

            for (int i = 0; i < childs.Length; i++)
            {
                childs[i] = GenericTypeSerializer.Deserialize(_serializedChildStateIds[i], StateIdType);
            }

            return(childs);
        }
Exemple #6
0
        public void AddChild(object childStateId)
        {
            if (ContainsChild(childStateId) == false)
            {
                _serializedChildStateIds.Add(GenericTypeSerializer.Serialize(childStateId));

                if (_serializedChildStateIds.Count == 1)
                {
                    SetInitialChild(childStateId);
                }
            }
        }
Exemple #7
0
        public TransitionInfo(object StateFrom, object Trigger, object StateTo, ScriptableGuardCondition[] guardConditions)
        {
            _serializedStateFrom = GenericTypeSerializer.Serialize(StateFrom);
            _serializedStateTo   = GenericTypeSerializer.Serialize(StateTo);
            _serializedTrigger   = GenericTypeSerializer.Serialize(Trigger);

            _stateIdTypeFullName = StateFrom.GetType().FullName;
            _triggerTypeFullName = Trigger.GetType().FullName;

            if (guardConditions != null)
            {
                _guardConditions = new ScriptableGuardCondition[guardConditions.Length];
                guardConditions.CopyTo(_guardConditions, 0);
            }
        }
Exemple #8
0
        public bool ContainsChild(object childStateId)
        {
            for (int i = 0; i < _serializedChildStateIds.Count; i++)
            {
                var current = _serializedChildStateIds[i];

                var deserializedId = GenericTypeSerializer.Deserialize(current, StateIdType);

                if (HierarchicalStateMachineBuilderHelper.AreEquals(deserializedId, childStateId))
                {
                    return(true);
                }
            }

            return(false);
        }