mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added ability to get other instances of .net scripts using GetEntity<T>
This commit is contained in:
@@ -6,6 +6,21 @@ namespace Nuake.Net
|
||||
public class Scene
|
||||
{
|
||||
internal static unsafe delegate*<NativeString, int> GetEntityIcall;
|
||||
internal static unsafe delegate*<NativeString, NativeInstance<Entity>> GetEntityScriptIcall;
|
||||
|
||||
public static T? GetEntity<T>(string entityName) where T : class
|
||||
{
|
||||
NativeInstance<Entity> handle;
|
||||
unsafe { handle = GetEntityScriptIcall(entityName); }
|
||||
|
||||
Entity? entity = handle.Get();
|
||||
if (entity != null && entity is T)
|
||||
{
|
||||
return entity as T;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Entity GetEntity(string entityName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user