Added C# -> Trenchbrom entity definition with reflection system
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -27,6 +28,8 @@ namespace Nuake.Net
|
||||
internal static unsafe delegate*<int, NativeString> EntityGetNameIcall;
|
||||
internal static unsafe delegate*<int, NativeString, void> EntitySetNameIcall;
|
||||
internal static unsafe delegate*<int, bool> EntityIsValidIcall;
|
||||
internal static unsafe delegate*<NativeString, NativeArray<int>> EntityGetTargetsIcall;
|
||||
internal static unsafe delegate*<int, NativeString> EntityGetTargetIcall;
|
||||
|
||||
public enum ComponentTypes
|
||||
{
|
||||
@@ -55,6 +58,37 @@ namespace Nuake.Net
|
||||
NAVMESH
|
||||
}
|
||||
|
||||
public List<Entity> Targets
|
||||
{
|
||||
get
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
var targetIds = EntityGetTargetsIcall(Target);
|
||||
|
||||
List<Entity> targets = new List<Entity>();
|
||||
foreach(var target in targetIds)
|
||||
{
|
||||
bool hasInstance = EntityHasManagedInstanceIcall(target);
|
||||
Entity entityInstance;
|
||||
if (hasInstance)
|
||||
{
|
||||
entityInstance = Scene.GetEntity<Entity>(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityInstance = new Entity(ECSHandle);
|
||||
}
|
||||
|
||||
targets.Add(entityInstance);
|
||||
}
|
||||
|
||||
return targets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Target { get { unsafe { return EntityGetTargetIcall(ECSHandle); } }}
|
||||
|
||||
public int ID { get; set; }
|
||||
public int ECSHandle { get; set; } = -1;
|
||||
@@ -99,6 +133,11 @@ namespace Nuake.Net
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Activate(Entity triggeredFrom)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Physics
|
||||
public void OnCollisionInternal(int entity)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user