Add Color record struct, small refactor, create a DaggerFramework.SceneGraph namespace.
This commit is contained in:
27
Source/SceneGraph/Entities/Entity.cs
Executable file
27
Source/SceneGraph/Entities/Entity.cs
Executable file
@@ -0,0 +1,27 @@
|
||||
using DaggerFramework.Audio;
|
||||
|
||||
namespace DaggerFramework.SceneGraph
|
||||
{
|
||||
public class Entity
|
||||
{
|
||||
public EntityLayer Layer { get; set; }
|
||||
public InputHandler Input => Layer.Scene.Input;
|
||||
public AudioBackend Audio => Layer.Scene.Audio;
|
||||
public int Id { get; set; }
|
||||
|
||||
public void Start() => OnStart();
|
||||
public void Update(double dt) => OnUpdate(dt);
|
||||
public void ReceiveInput(InputHandler input) => OnInput(input);
|
||||
|
||||
protected virtual void OnStart() { }
|
||||
protected virtual void OnDestroy() { }
|
||||
protected virtual void OnUpdate(double dt) { }
|
||||
protected virtual void OnInput(InputHandler input) { }
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
OnDestroy();
|
||||
Layer?.DestroyEntity(Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user