|
|
@@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using RobocraftX.Character; |
|
|
|
using RobocraftX.Character.Movement; |
|
|
|
using Unity.Mathematics; |
|
|
|
using RobocraftX.Common; |
|
|
|
using RobocraftX.Common.Players; |
|
|
@@ -17,7 +18,7 @@ namespace TechbloxModdingAPI |
|
|
|
/// <summary> |
|
|
|
/// An in-game player character. Any Leo you see is a player. |
|
|
|
/// </summary> |
|
|
|
public partial class Player : IEquatable<Player>, IEquatable<EGID> |
|
|
|
public class Player : IEquatable<Player>, IEquatable<EGID> |
|
|
|
{ |
|
|
|
// static functionality |
|
|
|
private static PlayerEngine playerEngine = new PlayerEngine(); |
|
|
@@ -350,6 +351,58 @@ namespace TechbloxModdingAPI |
|
|
|
public PlayerBuildingMode BuildingMode => (PlayerBuildingMode) playerEngine |
|
|
|
.GetCharacterStruct<PlayerInputTimeStoppedContextStruct>(Id).Get().timeStoppedContext; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Whether the player is sprinting. |
|
|
|
/// </summary> |
|
|
|
public bool Sprinting |
|
|
|
{ |
|
|
|
get => GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementComponent>(Id).Get().sprinting |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementEntityStruct>(Id).Get().isSprinting; |
|
|
|
set => _ = GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementComponent>(Id).Get().sprinting = value |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementEntityStruct>(Id).Get().isSprinting = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Movement speed setting. Build mode (camera) and simulation mode settings are separate. |
|
|
|
/// </summary> |
|
|
|
public float SpeedSetting |
|
|
|
{ |
|
|
|
get => GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().speed |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().moveSpeed; |
|
|
|
set => _ = GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().speed = value |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().moveSpeed = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The multiplier setting to use when sprinting. Build mode (camera) and simulation mode settings are separate. |
|
|
|
/// </summary> |
|
|
|
public float SpeedSprintMultiplierSetting |
|
|
|
{ |
|
|
|
get => GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().speedSprintMultiplier |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().sprintSpeedMultiplier; |
|
|
|
set => _ = GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().speedSprintMultiplier = value |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().sprintSpeedMultiplier = value; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The acceleration setting of the player. Build mode (camera) and simulation mode settings are separate. |
|
|
|
/// </summary> |
|
|
|
public float AccelerationSetting |
|
|
|
{ |
|
|
|
get => GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().acceleration |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().acceleration; |
|
|
|
set => _ = GameState.IsBuildMode() |
|
|
|
? playerEngine.GetCharacterStruct<FlyCamMovementSettingsComponent>(Id).Get().acceleration = value |
|
|
|
: playerEngine.GetCharacterStruct<CharacterMovementSettingsEntityStruct>(Id).Get().acceleration = value; |
|
|
|
} |
|
|
|
|
|
|
|
// object methods |
|
|
|
|
|
|
|
/// <summary> |
|
|
|