mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Remove native script component
This commit is contained in:
@@ -308,34 +308,6 @@ namespace GlitchyEngine.World
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NativeScriptComponent : IDisposableComponent
|
|
||||||
{
|
|
||||||
public ScriptableEntity Instance = null;
|
|
||||||
|
|
||||||
public function void (mut NativeScriptComponent this) Func;
|
|
||||||
|
|
||||||
public function ScriptableEntity () InstantiateFunction;
|
|
||||||
public function void (NativeScriptComponent* self) DestroyInstanceFunction;
|
|
||||||
|
|
||||||
public void Bind<T>() mut where T : ScriptableEntity
|
|
||||||
{
|
|
||||||
InstantiateFunction = () =>
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
};
|
|
||||||
|
|
||||||
DestroyInstanceFunction = (self) =>
|
|
||||||
{
|
|
||||||
delete self.Instance;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() mut
|
|
||||||
{
|
|
||||||
DestroyInstanceFunction(&this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SceneLight
|
struct SceneLight
|
||||||
{
|
{
|
||||||
public enum LightType
|
public enum LightType
|
||||||
|
|||||||
@@ -622,19 +622,6 @@ namespace GlitchyEngine.World
|
|||||||
{
|
{
|
||||||
Debug.Profiler.ProfileScope!("Update scripts");
|
Debug.Profiler.ProfileScope!("Update scripts");
|
||||||
|
|
||||||
// Run scripts
|
|
||||||
for (var (entity, script) in _ecsWorld.Enumerate<NativeScriptComponent>())
|
|
||||||
{
|
|
||||||
if (script.Instance == null)
|
|
||||||
{
|
|
||||||
script.Instance = script.InstantiateFunction();
|
|
||||||
script.Instance._entity = Entity(entity, this);
|
|
||||||
script.Instance.[Friend]OnCreate();
|
|
||||||
}
|
|
||||||
|
|
||||||
script.Instance.[Friend]OnUpdate(gameTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run scripts
|
// Run scripts
|
||||||
for (let (entity, script) in _ecsWorld.Enumerate<ScriptComponent>())
|
for (let (entity, script) in _ecsWorld.Enumerate<ScriptComponent>())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user