Class GameObject
A component that groups together child components.
public sealed class GameObject : Component, IEnumerable<Component>, IEnumerable
- Inheritance
-
GameObject
- Implements
- Inherited Members
Constructors
GameObject()
Initializes a new instance of the GameObject class.
public GameObject()
GameObject(params Component[])
Initializes a new instance of the GameObject class with the provided components.
public GameObject(params Component[] components)
Parameters
componentsComponent[]The components that the GameObject should contain.
Properties
Bus
Gets the local message bus.
public LocalMessageBus Bus { get; }
Property Value
Methods
Activate()
Called when this element is added to a Game.
protected override void Activate()
Add(params Component[])
Adds the provided components to this game object.
public void Add(params Component[] components)
Parameters
componentsComponent[]The components to add.
Deactivate()
Called when this element is removed from its Game.
protected override void Deactivate()
GetAll<TComponent>()
Gets all components of type TComponent.
public IEnumerable<TComponent> GetAll<TComponent>()
Returns
- IEnumerable<TComponent>
The collection of all matching components.
Type Parameters
TComponentThe type of component to look for.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Component> GetEnumerator()
Returns
- IEnumerator<Component>
An enumerator that can be used to iterate through the collection.
Get<TComponent>()
Gets a component of type TComponent.
public TComponent Get<TComponent>()
Returns
- TComponent
The component if one is found or null.
Type Parameters
TComponentThe type of component to look for.
Remove(Component)
Removes the provided component from this game object.
public void Remove(Component component)
Parameters
componentComponentThe component to remove.
Exceptions
- InvalidOperationException
Thrown if the provided
componentis not part of this game object.
Tick()
Called once per tick.
protected override void Tick()