예제 #1
0
        public bool isEnabledFor(StateOverseer so, State state)
        {
            var attrs = so.GetType().GetCustomAttributes(typeof(OffOnState), true);

            if (attrs != null)
            {
                foreach (OffOnState a in (OffOnState[])attrs)
                {
                    if (currentState == null)
                    {
                        if (a.type == null)
                        {
                            return(false);
                        }
                    }
                    else if (a.type != null)
                    {
                        if (a.type.IsAssignableFrom(currentState.GetType()))
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
예제 #2
0
 public void AddOverseer(StateOverseer so)
 {
     if (so == null)
     {
         throw new System.NullReferenceException("so == null");
     }
     _overseers.Add(so);
     so.IntroduceStateMachine(this);
     so.Initialize();
 }
예제 #3
0
 public void RemoveOverseer(StateOverseer so)
 {
     _overseers.Remove(so);
 }