70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
using System.Runtime.InteropServices;
|
|
using FlaxEngine;
|
|
|
|
namespace Game
|
|
{
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct PlayerInputState
|
|
{
|
|
public ulong frame;
|
|
public float viewDeltaX, viewDeltaY;
|
|
public float moveForward;
|
|
public float moveRight;
|
|
public bool attacking;
|
|
public bool jumping;
|
|
|
|
public Float3 verificationPosition;
|
|
public Float3 verificationVelocity;
|
|
public Float3 verificationViewAngles;
|
|
public Quaternion verificationOrientation;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct PlayerActorState
|
|
{
|
|
public Float3 position;
|
|
public Float3 velocity;
|
|
public Quaternion orientation;
|
|
public Float3 viewAngles; // yaw, pitch, roll
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct PlayerState
|
|
{
|
|
public PlayerInputState input;
|
|
public PlayerActorState actor;
|
|
}
|
|
|
|
public class PlayerInput
|
|
{
|
|
public const byte DemoVer = 1;
|
|
public PlayerState currentState;
|
|
public ulong frame;
|
|
|
|
public virtual void OnUpdate()
|
|
{
|
|
}
|
|
|
|
public virtual void OnFixedUpdate()
|
|
{
|
|
}
|
|
|
|
public virtual void OnEndFrame()
|
|
{
|
|
}
|
|
|
|
public virtual void RecordCurrentActorState(PlayerActorState actorState)
|
|
{
|
|
}
|
|
|
|
public PlayerInputState GetCurrentInputState()
|
|
{
|
|
return currentState.input;
|
|
}
|
|
|
|
public PlayerActorState GetCurrentActorState()
|
|
{
|
|
return currentState.actor;
|
|
}
|
|
}
|
|
} |