From dc551fb85cbbb42a4d8089795fab928b7491168b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Fri, 1 Dec 2023 23:51:53 +0100 Subject: [PATCH] Remove native script component --- .../src/World/Components/Components.bf | 28 ------------------- GlitchyEngine/src/World/Scene.bf | 13 --------- 2 files changed, 41 deletions(-) diff --git a/GlitchyEngine/src/World/Components/Components.bf b/GlitchyEngine/src/World/Components/Components.bf index af18316..703c5b0 100644 --- a/GlitchyEngine/src/World/Components/Components.bf +++ b/GlitchyEngine/src/World/Components/Components.bf @@ -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() mut where T : ScriptableEntity - { - InstantiateFunction = () => - { - return new T(); - }; - - DestroyInstanceFunction = (self) => - { - delete self.Instance; - }; - } - - public void Dispose() mut - { - DestroyInstanceFunction(&this); - } - } - struct SceneLight { public enum LightType diff --git a/GlitchyEngine/src/World/Scene.bf b/GlitchyEngine/src/World/Scene.bf index d677367..d4628e9 100644 --- a/GlitchyEngine/src/World/Scene.bf +++ b/GlitchyEngine/src/World/Scene.bf @@ -622,19 +622,6 @@ namespace GlitchyEngine.World { Debug.Profiler.ProfileScope!("Update scripts"); - // Run scripts - for (var (entity, script) in _ecsWorld.Enumerate()) - { - 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 for (let (entity, script) in _ecsWorld.Enumerate()) {