namespace Wayne.Lib.StateEngine.Generic { /// <summary> /// Generic timeout state class that has a main object of a generic type. /// </summary> /// <typeparam name="TMain">Specifies the type of the main object.</typeparam> /// <typeparam name="TData">Specifies the type of state data the state uses.</typeparam> public abstract class TimeoutState<TMain, TData> : TimeoutState<TMain> where TData : StateData { #region Fields private IStateWithData stateWithData; #endregion #region Properties /// <summary> /// Gets the state data for this state. /// </summary> protected TData Data { get { if (stateWithData == null) { stateWithData = StateData.GetParentCompositeStateWithStateData<TData>(this); } return stateWithData.StateData as TData; } } #endregion } }