wip: Revert OctoPlayer

This commit is contained in:
Alexandre Coirier
2026-05-25 22:46:50 +02:00
parent 746c6ce13c
commit a234ba2a7d
4 changed files with 114 additions and 141 deletions
@@ -8,6 +8,7 @@ namespace OctoCore.Components
[System.Serializable]
public class State
{
public bool ForcePlayerToFollowTarget;
[Range(0, 1)] public float MoveInfluence;
[Range(0, 1)] public float LookInfluence;
[Range(0, 180)] public float YawRange = 180;
@@ -91,6 +92,11 @@ namespace OctoCore.Components
_events.OnDrive?.Invoke();
}
public void ForcePlayerToFollowTarget(bool force)
{
_state.ForcePlayerToFollowTarget = force;
}
public void ReleasePlayer()
{
OctoPlayer.Instance.ReleaseDrive();
@@ -109,7 +115,7 @@ namespace OctoCore.Components
return;
}
_state.MoveInfluence = Mathf.Clamp01(_state.MoveInfluence + delta * _settings.DriveStrength);
_state.MoveInfluence = Mathf.Clamp01(_state.MoveInfluence + delta * (_state.ForcePlayerToFollowTarget ? 1 : inMove.magnitude) * _settings.DriveStrength);
float moveInfluence = _settings.DriveCurve.Evaluate(_state.MoveInfluence);
if (!_fullInfluenceReached && _state.MoveInfluence >= 1)
@@ -126,7 +132,7 @@ namespace OctoCore.Components
Vector3 driveMove = offset;
driveMove.y = 0;
driveMove = driveMove.normalized * inMove.magnitude;
driveMove = driveMove.normalized * (_state.ForcePlayerToFollowTarget ? 1 : inMove.magnitude);
driveMove = Vector3.Lerp(driveMove, Vector3.zero, driveAtten);
outMove = Vector3.Lerp(inMove, driveMove, moveInfluence);