mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Partial implementation of new entity accesors from scene tree path
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Coral.Managed.Interop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
@@ -20,7 +21,7 @@ namespace Nuake.Net
|
||||
{
|
||||
internal static unsafe delegate*<int, int, bool> EntityHasComponentIcall;
|
||||
internal static unsafe delegate*<int, bool> EntityHasManagedInstanceIcall;
|
||||
|
||||
internal static unsafe delegate*<int, NativeString, int> EntityGetEntityIcall;
|
||||
public enum ComponentTypes
|
||||
{
|
||||
Unknown = -1,
|
||||
@@ -122,5 +123,26 @@ namespace Nuake.Net
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Entity? GetEntity<T>(string path) where T : Entity
|
||||
{
|
||||
Entity entityInstance;
|
||||
unsafe
|
||||
{
|
||||
int entityHandle = EntityGetEntityIcall(ECSHandle, path );
|
||||
|
||||
bool hasInstance = EntityHasManagedInstanceIcall(entityHandle);
|
||||
if (hasInstance)
|
||||
{
|
||||
entityInstance = Scene.GetEntity<Entity>(entityHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityInstance = new Entity { ECSHandle = entityHandle };
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user