1
This commit is contained in:
@@ -27,8 +27,9 @@ namespace BITFALL.Entities.Player.Movement
|
||||
|
||||
[SerializeReference, SubclassSelector]
|
||||
private IProvider adsProvider;
|
||||
|
||||
[SerializeField] private LocationAdditive locationAdditive;
|
||||
|
||||
[SerializeField] private Transform cameraTransform;
|
||||
public Vector3 ViewCenter { get; set; }
|
||||
public Quaternion ViewRotation { get; set; }
|
||||
public Vector3 LocomotionBasedVelocity { get;private set; }
|
||||
@@ -43,8 +44,8 @@ namespace BITFALL.Entities.Player.Movement
|
||||
public ExpectState<bool> ExpectJump;
|
||||
public ExpectState<bool> ExpectCrouch;
|
||||
public ExpectState<bool> ExpectSprint;
|
||||
public ExpectState<Vector3> expectClimb;
|
||||
public Vector3 CurrentCameraPosition;
|
||||
public ExpectState<Vector3> ExpectClimb;
|
||||
public ExpectState<Vector3> CurrentCameraPosition;
|
||||
private readonly ValidHandle allowMovement = new();
|
||||
private readonly ValidHandle allowRun = new();
|
||||
private IEntityPhysics physics;
|
||||
@@ -53,7 +54,6 @@ namespace BITFALL.Entities.Player.Movement
|
||||
private Vector3 keepVelocity;
|
||||
public override void OnAwake()
|
||||
{
|
||||
CurrentCameraPosition = initialCameraPosition;
|
||||
_health = entity.Get<IHealth>();
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
physics = entity.Get<IEntityPhysics>();
|
||||
@@ -126,7 +126,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
var playerConfig = Data.Get<PlayerConfig>() ?? new PlayerConfig();
|
||||
var ads = adsProvider.Get<float>();
|
||||
if (ads is 0) ads = 1;
|
||||
var raw = context.ReadValue<Vector2>() * playerConfig.sensitivity * playerConfig.m_yaw * ads;
|
||||
var raw = context.ReadValue<Vector2>() * playerConfig.Sensitivity * playerConfig.M_Yaw * ads;
|
||||
var lookInput = LookInput;
|
||||
lookInput.x -= raw.y;
|
||||
lookInput.y += raw.x;
|
||||
@@ -148,7 +148,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
ExpectCrouch.Reset();
|
||||
if (climbClosePoint.TryGetClosePoint(out var closePoint))
|
||||
{
|
||||
expectClimb.shouldBe = closePoint;
|
||||
ExpectClimb.shouldBe = closePoint;
|
||||
TransitionState<Climb>();
|
||||
}
|
||||
}
|
||||
@@ -188,8 +188,10 @@ namespace BITFALL.Entities.Player.Movement
|
||||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
CurrentState?.BeforeUpdateMovement(deltaTime);
|
||||
|
||||
CurrentState?.AfterUpdateMovement(deltaTime);
|
||||
}
|
||||
|
||||
|
||||
public override void OnFixedUpdate(float deltaTime)
|
||||
{
|
||||
var currentVelocity = actor.Velocity;
|
||||
@@ -215,13 +217,19 @@ namespace BITFALL.Entities.Player.Movement
|
||||
public override void OnLateUpdate(float deltaTime)
|
||||
{
|
||||
if (allowMovement.Allow is false) return;
|
||||
var rotation = Quaternion.Euler(LookInput);
|
||||
cameraTransform.rotation = rotation;
|
||||
CurrentState?.AfterUpdateMovement(deltaTime);
|
||||
cameraTransform.localPosition = Vector3.Lerp(cameraTransform.localPosition,CurrentCameraPosition,5 * deltaTime);
|
||||
var additiveTransform = locationAdditive.transform;
|
||||
|
||||
var rotation = Quaternion.Euler(LookInput);
|
||||
|
||||
locationAdditive.SetGlobalRotation(rotation);
|
||||
|
||||
CurrentCameraPosition.being = Vector3.Lerp(CurrentCameraPosition.being,CurrentCameraPosition.shouldBe,5 * deltaTime);
|
||||
|
||||
locationAdditive.AddPosition(CurrentCameraPosition);
|
||||
|
||||
ViewCenter = cameraTransform.position;
|
||||
ViewRotation = rotation;
|
||||
|
||||
ViewCenter = additiveTransform.position + additiveTransform.forward;
|
||||
}
|
||||
|
||||
public void AddViewEuler(float2 euler)
|
||||
|
Reference in New Issue
Block a user