TechbloxModdingAPI/GamecraftModdingAPI/FlyCam.cs

26 lines
643 B
C#
Raw Normal View History

using GamecraftModdingAPI.Players;
using Svelto.ECS.EntityStructs;
using Unity.Mathematics;
namespace GamecraftModdingAPI
{
public class FlyCam
{
private static FlyCamEngine Engine;
public uint Id { get; }
public FlyCam(uint id) => Id = id;
public unsafe float3 Position
{
get => Engine.GetComponent<PositionEntityStruct>(Id).Map(pos => &pos->position);
set => Engine.GetComponent<PositionEntityStruct>(Id).Map(pos => &pos->position).Set(value);
}
public static void Init()
{
Engine = new FlyCamEngine();
}
}
}