wip: Revert OctoPlayer
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user