Пример #1
0
        /// <summary>
        /// Returns a State of type <typeparamref name="Tstate"/> attached to the StateMachine, it adds it to the StateMachine if not found
        /// </summary>
        /// <typeparam name="Tstate">Type of the state</typeparam>
        /// <returns>The State of type <typeparamref name="Tstate"/> attached to the machine</returns>
        public virtual Tstate GetState <Tstate>() where Tstate : State
        {
            if (!IsValidStateType(typeof(Tstate)))
            {
                return(null);
            }
            Tstate target = GetComponent <Tstate>();

            if (target == null)
            {
                target = gameObject.AddComponent <Tstate>();
            }
            return(target);
        }
Пример #2
0
 public MoveOperation(Tstate nextState, bool immediately)
 {
     NextState   = nextState;
     Immediately = immediately;
 }
Пример #3
0
 public State(Tstate state, Func <Socket, IOMultiPlex, MoveOperation> handler)
 {
     this.MatchState = state;
     this.Handler    = handler;
 }