Native scripting

This commit is contained in:
Simon Lübeß
2022-03-03 01:39:04 +01:00
parent cbee9f59d8
commit e82f70ba02
5 changed files with 113 additions and 2 deletions
@@ -0,0 +1,31 @@
namespace GlitchyEngine.World
{
class ScriptableEntity
{
internal Entity _entity;
public T* AddComponent<T>(T value = T()) where T: struct, new
{
return _entity.AddComponent<T>(value);
}
public T* GetComponent<T>() where T: struct, new
{
return _entity.GetComponent<T>();
}
public bool HasComponent<T>() where T: struct, new
{
return _entity.HasComponent<T>();
}
public void RemoveComponent<T>() where T: struct, new
{
_entity.RemoveComponent<T>();
}
protected virtual void OnCreate() {}
protected virtual void OnDestroy() {}
protected virtual void OnUpdate(GameTime gt) {}
}
}