Added ShowMouse and get global position to .net api, deferred onInit after all entities have been initialized

This commit is contained in:
Antoine Pilote
2024-03-16 16:37:38 -04:00
parent a5ca094c5f
commit 69205ec4fa
6 changed files with 61 additions and 7 deletions

View File

@@ -52,13 +52,22 @@ namespace Nuake
if (netScriptComponent.ScriptPath.empty())
continue;
// Creates an instance of the entity script in C#
auto entity = Entity{ e, m_Scene };
scriptingEngineNet.RegisterEntityScript(entity);
// We can now call on init on it.
auto scriptInstance = scriptingEngineNet.GetEntityScript(entity);
scriptInstance.InvokeMethod("OnInit");
// Creates an instance of the entity script in C#
scriptingEngineNet.RegisterEntityScript(entity);
}
for (auto& e : netEntities)
{
auto entity = Entity{ e, m_Scene };
if (entity.IsValid() && scriptingEngineNet.HasEntityScriptInstance(entity))
{
// We can now call on init on it.
auto scriptInstance = scriptingEngineNet.GetEntityScript(entity);
scriptInstance.InvokeMethod("OnInit");
}
}
return true;