Class GameState
GameState's contain Instances and controls them
Inheritance
Inherited Members
Namespace: Inferno
Assembly: Inferno.Desktop.dll
Syntax
public class GameState
Constructors
| Improve this Doc View SourceGameState(Game)
Create a new game state
Declaration
public GameState(Game parentGame)
Parameters
Type | Name | Description |
---|---|---|
Game | parentGame | Game that the state belongs to |
GameState(Game, Int32, Int32, Color, Int32)
Create a new game state
Declaration
public GameState(Game parentGame, int stateWidth, int stateHeight, Color stateBackgroundColor, int spaceSize = 32)
Parameters
Type | Name | Description |
---|---|---|
Game | parentGame | Game that the state belongs to |
System.Int32 | stateWidth | Width of the state |
System.Int32 | stateHeight | Height of the state |
Color | stateBackgroundColor | The state background color |
System.Int32 | spaceSize | The size for each spatial "block" |
GameState(Game, Int32, Int32, Sprite, Int32)
Create a new game state
Declaration
public GameState(Game parentGame, int stateWidth, int stateHeight, Sprite stateBackground, int spaceSize = 32)
Parameters
Type | Name | Description |
---|---|---|
Game | parentGame | Game that the state belongs to |
System.Int32 | stateWidth | Width of the state |
System.Int32 | stateHeight | Height of the state |
Sprite | stateBackground | The state background image |
System.Int32 | spaceSize | The size for each spatial "block" |
Fields
| Improve this Doc View SourceBackground
The state background image
Declaration
public Sprite Background
Field Value
Type | Description |
---|---|
Sprite |
BackgroundDepth
The depth to draw the background at
Declaration
public float BackgroundDepth
Field Value
Type | Description |
---|---|
System.Single |
Camera
The game translation camera
Declaration
public Camera Camera
Field Value
Type | Description |
---|---|
Camera |
DrawMode
The draw config
Declaration
public DrawMode DrawMode
Field Value
Type | Description |
---|---|
DrawMode |
Height
The height of the state
Declaration
public int Height
Field Value
Type | Description |
---|---|
System.Int32 |
OnDraw
On state drawn
Declaration
public EventHandler<GameState.StateOnDrawEventArgs> OnDraw
Field Value
Type | Description |
---|---|
System.EventHandler<GameState.StateOnDrawEventArgs> |
OnLoad
On state loaded
Declaration
public EventHandler OnLoad
Field Value
Type | Description |
---|---|
System.EventHandler |
OnUnLoad
On state unloaded
Declaration
public EventHandler OnUnLoad
Field Value
Type | Description |
---|---|
System.EventHandler |
OnUpdate
On state updated
Declaration
public EventHandler OnUpdate
Field Value
Type | Description |
---|---|
System.EventHandler |
ParentGame
The game that the state belongs to
Declaration
public readonly Game ParentGame
Field Value
Type | Description |
---|---|
Game |
SafeZone
The safe zone
Declaration
public Rectangle SafeZone
Field Value
Type | Description |
---|---|
Rectangle |
SafeZoneEnabled
Whether or not the safe zone is enabled
Declaration
public bool SafeZoneEnabled
Field Value
Type | Description |
---|---|
System.Boolean |
SpaceSize
The size of each spatial "block"
Declaration
public readonly int SpaceSize
Field Value
Type | Description |
---|---|
System.Int32 |
SpatialMode
The spatial hashing config
Declaration
public SpatialMode SpatialMode
Field Value
Type | Description |
---|---|
SpatialMode |
UpdateMode
The Update config
Declaration
public UpdateMode UpdateMode
Field Value
Type | Description |
---|---|
UpdateMode |
UserInterface
The state user interface
Declaration
public UserInterface UserInterface
Field Value
Type | Description |
---|---|
UserInterface |
Width
The width of the state
Declaration
public int Width
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
| Improve this Doc View SourceBounds
The state bounds
Declaration
public Rectangle Bounds { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Methods
| Improve this Doc View SourceAddInstance(Instance)
Add an instance to the state
Declaration
public void AddInstance(Instance instance)
Parameters
Type | Name | Description |
---|---|---|
Instance | instance | Instance to add |
ClearInstances()
Remove all instances from the state
Declaration
public void ClearInstances()
GetInstancesAt(Vector2, Boolean)
Get instances at the given position
Declaration
public List<Instance> GetInstancesAt(Vector2 position, bool boundBySafearea = false)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | Position |
System.Boolean | boundBySafearea | Search only within the safe zone |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Instance> |
GetNearbyInstances(Instance)
Get instances near the given instance
Declaration
public List<Instance> GetNearbyInstances(Instance instance)
Parameters
Type | Name | Description |
---|---|---|
Instance | instance | Instance to look around |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Instance> | All instances within one spatial "block" of the given instance |
RemoveInstance(Instance)
Remove an instance from the state
Declaration
public void RemoveInstance(Instance instance)
Parameters
Type | Name | Description |
---|---|---|
Instance | instance | Instance to remove |
Spatial_GetSpaces(Instance)
Get all the spaces that contain the instance
Declaration
public List<int> Spatial_GetSpaces(Instance instance)
Parameters
Type | Name | Description |
---|---|---|
Instance | instance |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
Spatial_GetSpaces(Rectangle)
Declaration
public List<int> Spatial_GetSpaces(Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rect |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
Spatial_MoveInstance(Rectangle, Rectangle, Instance)
Declaration
public void Spatial_MoveInstance(Rectangle oldBounds, Rectangle newBounds, Instance instance)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | oldBounds | |
Rectangle | newBounds | |
Instance | instance |