Class GameSystemBase
Base class for a GameSystemBase component.
public abstract class GameSystemBase : ComponentBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
- Inheritance
-
GameSystemBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
A GameSystemBase component can be used to
Constructors
GameSystemBase(IServiceRegistry)
Initializes a new instance of the GameSystemBase class.
protected GameSystemBase(IServiceRegistry registry)
Parameters
registry
IServiceRegistryThe registry.
Remarks
The GameSystem is expecting the following services to be registered: IGame and IContentManager.
Properties
Content
Gets the content manager. This value can be null in a mock environment.
protected IContentManager Content { get; }
Property Value
- IContentManager
The content.
DrawOrder
Gets the draw order relative to other objects. IDrawable objects with a lower value are drawn first.
public int DrawOrder { get; set; }
Property Value
- int
The draw order.
Enabled
Gets a value indicating whether the game component's Update method should be called by Update(GameTime).
public bool Enabled { get; set; }
Property Value
- bool
true
if update is enabled; otherwise,false
.
Game
Gets the Game associated with this GameSystemBase. This value can be null in a mock environment.
public GameBase Game { get; }
Property Value
- GameBase
The game.
Remarks
This value can be null
GraphicsDevice
Gets the graphics device.
protected GraphicsDevice GraphicsDevice { get; }
Property Value
- GraphicsDevice
The graphics device.
Services
Gets the services registry.
public IServiceRegistry Services { get; }
Property Value
- IServiceRegistry
The services registry.
UpdateOrder
Gets the update order relative to other game components. Lower values are updated first.
public int UpdateOrder { get; set; }
Property Value
- int
The update order.
Visible
Gets a value indicating whether the Draw(GameTime) method should be called by Draw(GameTime).
public bool Visible { get; set; }
Property Value
- bool
true
if this drawable component is visible; otherwise,false
.
Methods
BeginDraw()
Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw.
public virtual bool BeginDraw()
Returns
- bool
true
if Draw should occur,false
otherwise
Draw(GameTime)
Draws this instance.
public virtual void Draw(GameTime gameTime)
Parameters
gameTime
GameTimeThe current timing.
EndDraw()
Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw.
public virtual void EndDraw()
InitGraphicsDeviceService()
protected void InitGraphicsDeviceService()
Initialize()
This method is called when the component is added to the game.
public virtual void Initialize()
Remarks
This method can be used for tasks like querying for services the component needs and setting up non-graphics resources.
LoadContent()
protected virtual void LoadContent()
OnDrawOrderChanged(object, EventArgs)
protected virtual void OnDrawOrderChanged(object source, EventArgs e)
Parameters
OnUpdateOrderChanged(object, EventArgs)
protected virtual void OnUpdateOrderChanged(object source, EventArgs e)
Parameters
UnloadContent()
protected virtual void UnloadContent()
Update(GameTime)
This method is called when this game component is updated.
public virtual void Update(GameTime gameTime)
Parameters
gameTime
GameTimeThe current timing.
Events
DrawOrderChanged
Occurs when the DrawOrder property changes.
public event EventHandler<EventArgs> DrawOrderChanged
Event Type
EnabledChanged
Occurs when the Enabled property changes.
public event EventHandler<EventArgs> EnabledChanged
Event Type
UpdateOrderChanged
Occurs when the UpdateOrder property changes.
public event EventHandler<EventArgs> UpdateOrderChanged
Event Type
VisibleChanged
Occurs when the Visible property changes.
public event EventHandler<EventArgs> VisibleChanged