|
|
@@ -1,4 +1,5 @@ |
|
|
|
using RobocraftX.Physics; |
|
|
|
using Svelto.ECS; |
|
|
|
using Svelto.ECS.EntityStructs; |
|
|
|
using Techblox.FlyCam; |
|
|
|
using TechbloxModdingAPI.Players; |
|
|
@@ -8,13 +9,13 @@ using UnityEngine; |
|
|
|
|
|
|
|
namespace TechbloxModdingAPI |
|
|
|
{ |
|
|
|
public class FlyCam |
|
|
|
public class FlyCam : EcsObjectBase |
|
|
|
{ |
|
|
|
private static FlyCamEngine Engine = new FlyCamEngine(); |
|
|
|
|
|
|
|
public uint Id { get; } |
|
|
|
public override EGID Id { get; } |
|
|
|
|
|
|
|
public FlyCam(uint id) => Id = id; |
|
|
|
public FlyCam(uint id) => Id = new EGID(id, Techblox.FlyCam.FlyCam.Group); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The local player's camera. |
|
|
@@ -26,11 +27,11 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float3 Position |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<PositionEntityStruct>(Id).Get().position; |
|
|
|
get => Engine.GetComponent<PositionEntityStruct>(this).position; |
|
|
|
set |
|
|
|
{ |
|
|
|
Engine.GetComponent<PositionEntityStruct>(Id).Get().position = value; |
|
|
|
Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().position = value; |
|
|
|
Engine.GetComponent<PositionEntityStruct>(this).position = value; |
|
|
|
Engine.GetComponent<RigidBodyEntityStruct>(this).position = value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -39,11 +40,11 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float3 Rotation |
|
|
|
{ |
|
|
|
get => ((Quaternion) Engine.GetComponent<RotationEntityStruct>(Id).Get().rotation).eulerAngles; |
|
|
|
get => ((Quaternion) Engine.GetComponent<RotationEntityStruct>(this).rotation).eulerAngles; |
|
|
|
set |
|
|
|
{ |
|
|
|
Engine.GetComponent<RotationEntityStruct>(Id).Get().rotation = Quaternion.Euler(value); |
|
|
|
Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().rotation = Quaternion.Euler(value); |
|
|
|
Engine.GetComponent<RotationEntityStruct>(this).rotation = Quaternion.Euler(value); |
|
|
|
Engine.GetComponent<RigidBodyEntityStruct>(this).rotation = Quaternion.Euler(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -52,8 +53,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float3 MovementDirection |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<FlyCamMovementComponent>(Id).Get().movementDirection; |
|
|
|
set => Engine.GetComponent<FlyCamMovementComponent>(Id).Get().movementDirection = value; |
|
|
|
get => Engine.GetComponent<FlyCamMovementComponent>(this).movementDirection; |
|
|
|
set => Engine.GetComponent<FlyCamMovementComponent>(this).movementDirection = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -61,8 +62,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public bool Sprinting |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<FlyCamMovementComponent>(Id).Get().sprinting; |
|
|
|
set => Engine.GetComponent<FlyCamMovementComponent>(Id).Get().sprinting = value; |
|
|
|
get => Engine.GetComponent<FlyCamMovementComponent>(this).sprinting; |
|
|
|
set => Engine.GetComponent<FlyCamMovementComponent>(this).sprinting = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -70,8 +71,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float Speed |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().speed; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().speed = value; |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).speed; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).speed = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -79,8 +80,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float SpeedSprintMultiplier |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().speedSprintMultiplier; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().speedSprintMultiplier = value; |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).speedSprintMultiplier; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).speedSprintMultiplier = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -88,8 +89,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float Acceleration |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().acceleration; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(Id).Get().acceleration = value; |
|
|
|
get => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).acceleration; |
|
|
|
set => Engine.GetComponent<FlyCamMovementSettingsComponent>(this).acceleration = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -97,8 +98,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float3 Velocity |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().velocity; |
|
|
|
set => Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().velocity = value; |
|
|
|
get => Engine.GetComponent<RigidBodyEntityStruct>(this).velocity; |
|
|
|
set => Engine.GetComponent<RigidBodyEntityStruct>(this).velocity = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -106,8 +107,8 @@ namespace TechbloxModdingAPI |
|
|
|
/// </summary> |
|
|
|
public float3 AngularVelocity |
|
|
|
{ |
|
|
|
get => Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().angularVelocity; |
|
|
|
set => Engine.GetComponent<RigidBodyEntityStruct>(Id).Get().angularVelocity = value; |
|
|
|
get => Engine.GetComponent<RigidBodyEntityStruct>(this).angularVelocity; |
|
|
|
set => Engine.GetComponent<RigidBodyEntityStruct>(this).angularVelocity = value; |
|
|
|
} |
|
|
|
|
|
|
|
public static void Init() |
|
|
|