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); }
public void AddOverseer(StateOverseer so) { if (so == null) { throw new System.NullReferenceException("so == null"); } _overseers.Add(so); so.IntroduceStateMachine(this); so.Initialize(); }
public void RemoveOverseer(StateOverseer so) { _overseers.Remove(so); }