Interface IGameState
The game state. This is the entry point for all "changing" things in the game.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IGameState : IRoomProvider
Properties
| Improve this Doc View SourceCursor
Gets or sets the mouse cursor.
Declaration
IObject Cursor { get; set; }
Property Value
Type | Description |
---|---|
IObject | The mouse cursor. |
Cutscene
Controls the cutscenes.
Declaration
ICutscene Cutscene { get; }
Property Value
Type | Description |
---|---|
ICutscene | The cutscene. |
DuringRoomTransition
Gets a value indicating whether there is an on-going room transition.
Declaration
bool DuringRoomTransition { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
FocusedUI
Gets the UI controls which are currently getting focus (for example if a yes/no dialog pops up, it's focused and "takes" away the input from the game. If a text box is currently in use, it's focused and "takes" away keyboard input from the game.
Declaration
IFocusedUI FocusedUI { get; }
Property Value
Type | Description |
---|---|
IFocusedUI | The focused user interface. |
GlobalVariables
Custom properties that you can use for the entire game, to set custom behaviors. For example, you can add a "Score" variable here, to keep the game score.
Declaration
ICustomProperties GlobalVariables { get; }
Property Value
Type | Description |
---|---|
ICustomProperties | The global variables. |
Paused
Pause or resume the game. If the game is paused the state of the game will not update.
Declaration
bool Paused { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Player
The player character.
Declaration
ICharacter Player { get; set; }
Property Value
Type | Description |
---|---|
ICharacter | The player. |
Rooms
All of the rooms in the game.
Declaration
IAGSBindingList<IRoom> Rooms { get; }
Property Value
Type | Description |
---|---|
IAGSBindingList<IRoom> | The rooms. |
RoomTransitions
Controls the room transitions (animation effects when moving between rooms).
Declaration
IRoomTransitions RoomTransitions { get; }
Property Value
Type | Description |
---|---|
IRoomTransitions | The room transitions. |
SecondaryViewports
Allows adding multiple viewports to the game (so you can have split-screen functionality, for example, or having a TV in one room showing things happenning in another room).
Declaration
IAGSBindingList<IViewport> SecondaryViewports { get; }
Property Value
Type | Description |
---|---|
IAGSBindingList<IViewport> | The secondary viewports. |
Speed
The speed of the game's updates. This is listed in percentage from 60 FPS. By default, this is 100, so 100% of 60 FPS which is 60 FPS. For 30 FPS, put 50 as your speed. Note that this is the target FPS, the target which the engine will attempt to accomplish, there is no guarantee that it will actually succeed, though (that depends on the hardware and on how much resource-heavy is your game.
Declaration
int Speed { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The speed. |
UI
All of the non-room objects in the game. Those are usually GUIs which stay on the screen even if you switch between rooms (like the top bar, a hotspot label, inventory window, menus, etc).
Declaration
IConcurrentHashSet<IObject> UI { get; }
Property Value
Type | Description |
---|---|
IConcurrentHashSet<IObject> | The user interface. |
Viewport
The viewport decides what part of the room is actually seen on screen, and also where it's projected on the screen..
Declaration
IViewport Viewport { get; }
Property Value
Type | Description |
---|---|
IViewport | The viewport. |
Methods
| Improve this Doc View SourceAll<TEntity>()
Returns all entities of the specified type.
Declaration
IEnumerable<TEntity> All<TEntity>()
where TEntity : class, IEntity
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TEntity> | All entities of the specified type. |
Type Parameters
Name | Description |
---|---|
TEntity | The entity type. |
ChangeRoomAsync(IRoom, Action)
Changes the game's room to a new room. This will trigger the room transition, and then switch the camera to render the new room.
Declaration
Task ChangeRoomAsync(IRoom newRoom, Action afterTransitionFadeOut = null)
Parameters
Type | Name | Description |
---|---|---|
IRoom | newRoom | New room. |
System.Action | afterTransitionFadeOut | A possible callback which triggers after the fade out of the old room, but before the fade in of the new room. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that can be awaited for the room switch to complete. |
Clean()
Disposes resources for all current rooms and objects. This is called by the engine when loading a new game.
Declaration
void Clean()
CopyFrom(IGameState)
Overrides this state from another state. This is called by the engine when loading a new game.
Declaration
void CopyFrom(IGameState state)
Parameters
Type | Name | Description |
---|---|---|
IGameState | state | State. |
Find<TEntity>(String)
Find the entity with the specified id and type.
Declaration
TEntity Find<TEntity>(string id)
where TEntity : class, IEntity
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The entity's unique identifier. |
Returns
Type | Description |
---|---|
TEntity | The entity if found, null if no entity exists with that id. |
Type Parameters
Name | Description |
---|---|
TEntity | The entity's type. |
GetSortedViewports()
Gets the viewports sorted (in ascending order) by their Z index.
Declaration
List<IViewport> GetSortedViewports()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IViewport> | The sorted viewports. |