123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- 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
- }
- }
|