Added C# Point entities + automatic export of FGD entities

This commit is contained in:
Antoine Pilote
2024-09-01 19:37:05 -04:00
parent f59a7e931f
commit 63712edc6d
21 changed files with 534 additions and 479 deletions

View File

@@ -157,13 +157,25 @@ namespace Nuake.Net
public class CameraComponent : IComponent
{
internal static unsafe delegate*<int, NativeArray<float>> GetDirectionIcall;
internal static unsafe delegate*<int, float, void> SetCameraFOVIcall;
internal static unsafe delegate*<int, float> GetCameraFOVIcall;
public CameraComponent(int entityId)
{
EntityID = entityId;
}
public float FOV { get; set; }
public float FOV
{
get
{
unsafe { return GetCameraFOVIcall(EntityID); }
}
set
{
unsafe { SetCameraFOVIcall(EntityID, value); }
}
}
public Vector3 Direction
{
@@ -181,6 +193,9 @@ namespace Nuake.Net
public class AudioEmitterComponent : IComponent
{
internal static unsafe delegate*<int, bool> GetIsPlayingIcall;
internal static unsafe delegate*<int, bool, void> SetIsPlayingIcall;
public AudioEmitterComponent(int entityId)
{
EntityID = entityId;
@@ -190,7 +205,11 @@ namespace Nuake.Net
public bool Loop { get; set; }
public bool Spatialized { get; set; }
public bool Playing { get; set; }
public bool Playing
{
get { unsafe { return GetIsPlayingIcall(EntityID); } }
set { unsafe { SetIsPlayingIcall(EntityID, value); } }
}
}
public class ModelComponent : IComponent

View File

@@ -30,6 +30,23 @@ namespace Nuake.Net
}
}
public struct AABB
{
public Vector3 A;
public Vector3 B;
public AABB(Vector3 a, Vector3 b)
{
A = a;
B = b;
}
public AABB(float ax, float ay, float az, float bx, float by, float bz)
{
A = new Vector3(ax, ay, az);
B = new Vector3(bx, by, bz);
}
}
[AttributeUsage(AttributeTargets.Field)]
public sealed class ExposedAttribute : Attribute
@@ -53,12 +70,30 @@ namespace Nuake.Net
public sealed class PointScript : Attribute
{
public string Description = "";
public bool IsTrigger = false;
public Vector3 AABBA;
public Vector2 AABBB;
public List<float> AABBData = new();
public List<float> ColorData = new();
public Color Color
{
get { return Color; }
set
{
ColorData.Add(value.R);
ColorData.Add(value.G);
ColorData.Add(value.B);
}
}
string Model;
float ModelScale = 1.0f;
string Sprite;
public PointScript(string description = "")
{
Description = description;
IsTrigger = isTrigger;
}
}