Class Instance
A game object
Inheritance
Implements
Inherited Members
Namespace: Inferno
Assembly: Inferno.Desktop.dll
Syntax
public class Instance : IDisposable
Constructors
| Improve this Doc View SourceInstance(GameState)
Create a new instance
Declaration
public Instance(GameState parentState)
Parameters
Type | Name | Description |
---|---|---|
GameState | parentState | The state that owns the instance |
Instance(GameState, Vector2, Single, Boolean, Boolean, Instance)
Create a new instance
Declaration
public Instance(GameState parentState, Vector2 position, float depth = 0F, bool updates = false, bool draws = false, Instance parent = null)
Parameters
Type | Name | Description |
---|---|---|
GameState | parentState | The state that owns the instance |
Vector2 | position | The instance position |
System.Single | depth | The depth to draw the instance |
System.Boolean | updates | Whether or not the instance updates |
System.Boolean | draws | Whether or not the instance draws |
Instance | parent | The instance that this inherits from |
Fields
| Improve this Doc View SourceAffectedByGravity
Whether or not the Instance is affected by gravity
Declaration
public bool AffectedByGravity
Field Value
Type | Description |
---|---|
System.Boolean |
CollisionMode
The current collision mode
Declaration
public CollisionMode CollisionMode
Field Value
Type | Description |
---|---|
CollisionMode |
CollisionRectangle
The Collision Rectangle. Uses coordinates relative to the texture. If null, the instance dimensions will be used
Declaration
public Rectangle? CollisionRectangle
Field Value
Type | Description |
---|---|
System.Nullable<Rectangle> |
Depth
The depth that the instance will be drawn at
Declaration
public float Depth
Field Value
Type | Description |
---|---|
System.Single |
Draws
Whether or not the instance draws
Declaration
public bool Draws
Field Value
Type | Description |
---|---|
System.Boolean |
InheritsParentEvents
Whether or not the instance will inherit it's parent's events
Declaration
public bool InheritsParentEvents
Field Value
Type | Description |
---|---|
System.Boolean |
Parent
The instance's parent
Declaration
public Instance Parent
Field Value
Type | Description |
---|---|
Instance |
ParentState
The state that owns the instance
Declaration
public readonly GameState ParentState
Field Value
Type | Description |
---|---|
GameState |
Roughness
The roughness of the Instance used for friction
Declaration
public float Roughness
Field Value
Type | Description |
---|---|
System.Single |
Sprite
The instance's sprite
Declaration
public Sprite Sprite
Field Value
Type | Description |
---|---|
Sprite |
Updates
Whether or not the instance updates
Declaration
public bool Updates
Field Value
Type | Description |
---|---|
System.Boolean |
Velocity
The current velocity of the instance
Declaration
public Vector2 Velocity
Field Value
Type | Description |
---|---|
Vector2 |
Properties
| Improve this Doc View SourceBounds
The bounding box of the instance
Declaration
public Rectangle Bounds { get; }
Property Value
Type | Description |
---|---|
Rectangle |
CollisionMask
The sprite collision mask
Declaration
public Sprite CollisionMask { get; set; }
Property Value
Type | Description |
---|---|
Sprite |
Height
The height of the instance
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
NextPosition
Where the Instance will be next frame
Declaration
public Vector2 NextPosition { get; }
Property Value
Type | Description |
---|---|
Vector2 |
Position
The instance's position
Declaration
public Vector2 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Width
The width of the instance
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
X
The X Position of the Instance
Declaration
public float X { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Y
The Y Position of the Instance
Declaration
public float Y { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
| Improve this Doc View SourceBeginUpdate()
BeginUpdate
Declaration
public virtual void BeginUpdate()
Clone()
Clone the instance
Declaration
public Instance Clone()
Returns
Type | Description |
---|---|
Instance | A clone of the instance |
Colliding(Vector2, Type)
Whether or not the instance is touching anything
Declaration
public bool Colliding(Vector2 pos, Type instanceType = null)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | pos | The position to check at (For pre-movement checks) |
System.Type | instanceType | A specific type to check for |
Returns
Type | Description |
---|---|
System.Boolean | Whether or not it is touching anything (or the specified type) |
Colliding(Type)
Whether or not the instance is touching anything
Declaration
public bool Colliding(Type instanceType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | instanceType | A specific type to check for |
Returns
Type | Description |
---|---|
System.Boolean | Whether or not it is touching anything (or the specified type) |
Destroy()
Destroy the instance. Alias for Dispose().
Declaration
public void Destroy()
Dispose()
Dispose the instance
Declaration
public void Dispose()
Draw(Renderer)
Draw the instance
Declaration
public virtual void Draw(Renderer renderer)
Parameters
Type | Name | Description |
---|---|---|
Renderer | renderer | The game renderer |
EndUpdate()
EndUpdate
Declaration
public virtual void EndUpdate()
RemoveParent()
Remove the instance's parent
Declaration
public void RemoveParent()
SetParent(Instance)
Set the instance's parent
Declaration
public void SetParent(Instance parent)
Parameters
Type | Name | Description |
---|---|---|
Instance | parent |
Update()
Update
Declaration
public virtual void Update()