50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using RebootKit.Engine.Foundation;
|
|
using RebootKit.Engine.Services.Simulation;
|
|
using UnityEngine;
|
|
using Logger = RebootKit.Engine.Foundation.Logger;
|
|
|
|
namespace RebootKit.FPPKit {
|
|
public class FPPActor : Actor {
|
|
static readonly Logger s_logger = new(nameof(FPPActor));
|
|
|
|
// [field: SerializeField]
|
|
// public CharacterLocomotion Locomotion { get; private set; }
|
|
//
|
|
// [field: SerializeField]
|
|
// public FirstPersonCamera FPPCamera { get; private set; }
|
|
//
|
|
// [field: SerializeField]
|
|
// public PhysicsObjectDragger Dragger { get; private set; }
|
|
//
|
|
// [field: SerializeField]
|
|
// public float DragObjectDistanceFromCamera { get; private set; } = 2.0f;
|
|
|
|
[SerializeField] FPPLocomotion m_Locomotion;
|
|
[SerializeField] FPPCamera m_Camera;
|
|
|
|
[SerializeField] PhysicsObjectDragger m_PhysicsDragger;
|
|
[SerializeField] FloatRange m_DragDistanceRange = new(1.0f, 5.0f);
|
|
|
|
void Update() {
|
|
m_PhysicsDragger.TargetWorldPosition = m_Camera.Camera.transform.position + m_Camera.transform.forward * 2.0f;
|
|
}
|
|
|
|
public void Jump() {
|
|
m_Locomotion.Jump();
|
|
}
|
|
|
|
public void Look(Vector2 input) {
|
|
m_Camera.Rotate(input.x, input.y);
|
|
}
|
|
|
|
public void MoveRight(float input) {
|
|
Vector3 direction = Quaternion.AngleAxis(m_Camera.Yaw, Vector3.up) * Vector3.right;
|
|
m_Locomotion.AddMovementInput(direction, input);
|
|
}
|
|
|
|
public void MoveForward(float input) {
|
|
Vector3 direction = Quaternion.AngleAxis(m_Camera.Yaw, Vector3.up) * Vector3.forward;
|
|
m_Locomotion.AddMovementInput(direction, input);
|
|
}
|
|
}
|
|
} |