/// <summary> /// Describes an abstract game /// </summary> public abstract class BaseGame:DisposeSupport { /// <summary> /// The game Logic /// </summary> protected abstract ILogic Logic { get; } /// <summary> /// The game Physics /// </summary> protected abstract IPhysics Physics { get; } /// <summary> /// Initialize the game /// </summary> public void Initialize(){} /// <summary> /// Start the new game /// </summary> public void StartNewGame(){} /// <summary> /// Activate the game /// </summary> public void ActivateGame(){} /// <summary> /// Pause on game /// </summary> public void Pause(){} /// <summary> /// Restart the game /// </summary> public void Restart(){} /// <summary> /// Resume the game /// </summary> public void Resume(){} /// <summary> /// Exit the game /// </summary> public void Exit(){} public event Action Win; public event Action GameOver; public event Action Lose; }
/// <summary> /// Describes a renderer class /// </summary> /// <typeparam name="TInit">Type that used for method Initialize parameter</typeparam> /// <typeparam name="TRender">Type that used for methods Render and ScreenSizeChanged parameters</typeparam> public interface IRenderer<TInit, TRender>: IDisposable { /// <summary> /// On initialize a device /// </summary> /// <param name="initParameter">Initialize parameter</param> void Initialize(TInit initParameter); /// <summary> /// On render per frame /// </summary> /// <param name="renderParameter">Render parameter</param> void Render(TRender renderParameter); /// <summary> /// On screen size changed /// </summary> /// <param name="renderParameter">Render parameter</param> void ScreenSizeChanged(TRender renderParameter); }
/// <summary> /// Describes a game logic /// </summary> public interface ILogic { /// <summary> /// Start game /// </summary> void StartGame(); /// <summary> /// Stop game /// </summary> void StopGame(); /// <summary> /// Pause game /// </summary> void PauseGame(); /// <summary> /// Resume game /// </summary> void ResumeGame(); /// <summary> /// Fire game event /// </summary> void FireEvent(IGameEvent @event); /// <summary> /// Win game event /// </summary> event Action Win; /// <summary> /// Lose game event /// </summary> event Action Lose; /// <summary> /// Delete game object event /// </summary> event Action<string> ObjectDeleted; /// <summary> ///Character moved event /// </summary> event Action<string,float,float,float> CharacterMoved; /// <summary> ///Character moved by path event /// </summary> event Action<string, IList<PathData>> CharacterMovedPath; /// <summary> ///Character patrol by path event /// </summary> event Action<string, IList<PathData>> CharacterPatrolPath; /// <summary> ///Character patrol event /// </summary> event Action<string, float, float, float> CharacterPatrol; /// <summary> ///Character moved to object event /// </summary> event Action<string, string, float> CharacterMovedToObject; /// <summary> ///Character in chase for object event /// </summary> event Action<string, string, float> CharacterChase; /// <summary> /// watch if the one object look at another; /// </summary> event Action<string, string> WatchedLook; /// <summary> /// watch the distance between two objects; /// </summary> event Action<string, string, float> WatchedDistance; /// <summary> /// character stop; /// </summary> event Action<string> ActionStopped; /// <summary> ///The rules factory /// </summary> IRuleFactory RuleFactory { get; } }
public interface IPhysics { /// <summary> /// add object to simulation /// </summary> /// <param name="obj">object</param> void AddObject(IObject obj); /// <summary> /// remove object from simulation /// </summary> /// <param name="obj">object</param> void RemoveObject(IObject obj); /// <summary> /// simulate world on specified time after start /// </summary> /// <param name="time">seconds</param> void Simulate(float time); /// <summary> /// signal that initialization starts /// </summary> void BeginInitialization(); /// <summary> /// signal that initialization included adding of objects is finished /// </summary> void EndInitialization(); /// <summary> /// getting movement observer for observing different events related to movement of objects /// </summary> /// <returns>moevement observer</returns> IMovementObserver GetMovementObserver(); /// <summary> /// get object factory /// </summary> /// <returns>getting object factory</returns> IObjectFactory GetObjectFactory(); }
public interface IObject { /// <summary> /// getting transformation matrix of object /// </summary> /// <returns>matrix</returns> Matrix GetTransform(); float X { get; set; } float Y { get; set; } float Z { get; set; } }
Source: https://habr.com/ru/post/169981/
All Articles