Class GameElement
Represents a base class for game elements in the Genesis framework.
Inheritance
Inherited Members
Namespace: Genesis.Core
Assembly: Genesis.dll
Syntax
public abstract class GameElement
Constructors
GameElement()
Creates a new instance of the GameElement class.
Declaration
public GameElement()
Properties
Behaviors
Gets or sets the list of behaviors associated with the game element.
Declaration
public List<IGameBehavior> Behaviors { get; set; }
Property Value
Type | Description |
---|---|
List<IGameBehavior> |
Children
Gets or sets the list of child game elements.
Declaration
public List<GameElement> Children { get; set; }
Property Value
Type | Description |
---|---|
List<GameElement> |
Enabled
Gets or sets a value indicating whether the game element is enabled.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Location
Gets or sets the 3D coordinates of the game element.
Declaration
public Vec3 Location { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Name
Gets or sets the name of the game element.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Parent
Gets or sets the parent game element.
Declaration
public GameElement Parent { get; set; }
Property Value
Type | Description |
---|---|
GameElement |
Propertys
Gets or sets the properties associated with the game element.
Declaration
public Dictionary<string, object> Propertys { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, object> |
Rotation
Gets or sets the 3D rotation of the game element.
Declaration
public Vec3 Rotation { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Scene
Gets or sets the scene to which the game element belongs.
Declaration
public Scene Scene { get; set; }
Property Value
Type | Description |
---|---|
Scene |
Size
Gets or sets the 3D size of the game element.
Declaration
public Vec3 Size { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Tag
Gets or sets the tag associated with the game element.
Declaration
public string Tag { get; set; }
Property Value
Type | Description |
---|---|
string |
UUID
Gets or sets the unique identifier for the game element.
Declaration
public string UUID { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
AddBehavior(IGameBehavior)
Adds a behavior to the game element.
Declaration
public void AddBehavior(IGameBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
IGameBehavior | behavior | The behavior to be added. |
AddBehavior<T>(T)
Adds a behavior of type T to the game element and returns it.
Declaration
public T AddBehavior<T>(T behavior) where T : IGameBehavior
Parameters
Type | Name | Description |
---|---|---|
T | behavior | The behavior to be added. |
Returns
Type | Description |
---|---|
T | The added behavior of type T. |
Type Parameters
Name | Description |
---|---|
T | The type of the behavior. |
AddChild(GameElement)
Adds a child game element to the current game element.
Declaration
public void AddChild(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The child game element to be added. |
GetBehavior<T>()
Gets the first game behavior of type T.
Declaration
public T GetBehavior<T>() where T : IGameBehavior
Returns
Type | Description |
---|---|
T | The first game behavior of type T, or null if not found. |
Type Parameters
Name | Description |
---|---|
T | The type of the behavior. |
GetBehaviors<T>()
Returns all behaviors of type T.
Declaration
public List<IGameBehavior> GetBehaviors<T>()
Returns
Type | Description |
---|---|
List<IGameBehavior> | A list of all behaviors of type T. |
Type Parameters
Name | Description |
---|---|
T | The type of the behavior. |
GetInstance(GameElement)
Copies the properties from another game element instance to the current one.
Declaration
public virtual void GetInstance(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The game element from which to copy properties. |
HasTag(string)
Determines whether the current object has a tag that matches the specified value.
Declaration
public bool HasTag(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | The tag value to compare with the current object's tag. |
Returns
Type | Description |
---|---|
bool |
|
Init(Game, IRenderDevice)
Called when the game is initialized.
Declaration
public virtual void Init(Game game, IRenderDevice renderDevice)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
IRenderDevice | renderDevice | The rendering device. |
OnDestroy(Game)
Called when the game element is disposed.
Declaration
public virtual void OnDestroy(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
OnRender(Game, IRenderDevice)
Called when the game is rendered.
Declaration
public virtual void OnRender(Game game, IRenderDevice renderDevice)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
IRenderDevice | renderDevice | The rendering device. |
OnUpdate(Game, IRenderDevice)
Called when the game is updated.
Declaration
public virtual void OnUpdate(Game game, IRenderDevice renderDevice)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
IRenderDevice | renderDevice | The rendering device. |