1234567891011121314151617181920212223242526272829303132333435 |
- namespace Wayne.Lib.StateEngine.Generic
- {
- /// <summary>
- /// Generic pseudo 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 PseudoState<TMain, TData> : PseudoState<TMain> where TData : StateData
- {
- #region Fields
- private IStateWithData dataCompositeState;
- #endregion
- #region Properties
- /// <summary>
- /// Gets the state data for this state.
- /// </summary>
- protected TData Data
- {
- get
- {
- if (dataCompositeState == null)
- {
- dataCompositeState = StateData.GetParentCompositeStateWithStateData<TData>(this);
- }
- return dataCompositeState.StateData as TData;
- }
- }
- #endregion
- }
- }
|