Add detective board
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using Unheimlich.Interactions.Core;
|
||||
using Unheimlich.Data.CameraSettings;
|
||||
|
||||
namespace Unheimlich.Gameplay.Player
|
||||
{
|
||||
@@ -21,6 +22,9 @@ namespace Unheimlich.Gameplay.Player
|
||||
private PlayerMovement _playerMovement;
|
||||
private float _timer = 0f;
|
||||
private Vector3 _startLocalPos;
|
||||
|
||||
private HeadBobMode _overrideMode = HeadBobMode.Normal;
|
||||
private bool _hasOverride = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -33,7 +37,15 @@ namespace Unheimlich.Gameplay.Player
|
||||
if (_playerMovement == null || _playerMovement.CharacterController == null)
|
||||
return;
|
||||
|
||||
if (PlayerInspectionHandler.Instance != null && PlayerInspectionHandler.Instance.IsInspecting)
|
||||
HeadBobMode currentMode = _hasOverride ? _overrideMode : HeadBobMode.Normal;
|
||||
|
||||
if (currentMode == HeadBobMode.Disabled)
|
||||
{
|
||||
ResetPosition();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentMode == HeadBobMode.Idle || (PlayerInspectionHandler.Instance != null && PlayerInspectionHandler.Instance.IsInspecting))
|
||||
{
|
||||
ApplyBob(_idleBobSpeed, _idleBobAmplitude);
|
||||
return;
|
||||
@@ -52,6 +64,23 @@ namespace Unheimlich.Gameplay.Player
|
||||
else
|
||||
ResetPosition();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the head bob mode override.
|
||||
/// </summary>
|
||||
public void SetMode(HeadBobMode mode)
|
||||
{
|
||||
_overrideMode = mode;
|
||||
_hasOverride = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the override and returns to normal behavior.
|
||||
/// </summary>
|
||||
public void ClearOverride()
|
||||
{
|
||||
_hasOverride = false;
|
||||
}
|
||||
|
||||
private void ApplyBob(float speed, float amplitude)
|
||||
{
|
||||
|
||||
+4
-11
@@ -60,10 +60,6 @@ namespace Unheimlich.Gameplay.Player
|
||||
[Header("Touch Settings")]
|
||||
[SerializeField] private float _touchDistance = 2f;
|
||||
|
||||
[Header("Input Action")]
|
||||
[SerializeField] private InputActionReference _diapasonAction;
|
||||
[SerializeField] private InputActionReference _fireAction;
|
||||
|
||||
public bool IsListening { get; private set; }
|
||||
public bool IsConcentrating { get; private set; }
|
||||
|
||||
@@ -118,11 +114,6 @@ namespace Unheimlich.Gameplay.Player
|
||||
{
|
||||
_handTouchFeedback.SetActive(false);
|
||||
}
|
||||
|
||||
if (_diapasonAction == null)
|
||||
{
|
||||
Debug.LogError("[Diapason] _diapasonAction is NOT assigned! Please assign it in the Inspector.");
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -132,7 +123,8 @@ namespace Unheimlich.Gameplay.Player
|
||||
CheckForNearbyEmitter();
|
||||
}
|
||||
|
||||
if (_diapasonAction != null && _diapasonAction.action.WasPressedThisFrame())
|
||||
var diapasonAction = InputManager.GetDiapasonAction();
|
||||
if (diapasonAction != null && diapasonAction.WasPressedThisFrame())
|
||||
{
|
||||
if (!IsListening && !IsConcentrating && _canUseDiapason)
|
||||
{
|
||||
@@ -419,7 +411,8 @@ namespace Unheimlich.Gameplay.Player
|
||||
}
|
||||
|
||||
bool firePressed = false;
|
||||
if (_fireAction != null && _fireAction.action != null && _fireAction.action.WasPressedThisFrame())
|
||||
var fireAction = InputManager.GetFireAction();
|
||||
if (fireAction != null && fireAction.WasPressedThisFrame())
|
||||
{
|
||||
firePressed = true;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace Unheimlich.Gameplay.Player
|
||||
{
|
||||
_ySpeed = _groundedGravity;
|
||||
|
||||
if (PlayerInputManager.Instance.JumpAction.action.WasPressedThisFrame())
|
||||
var jumpAction = PlayerInputManager.GetJumpAction();
|
||||
if (jumpAction != null && jumpAction.WasPressedThisFrame())
|
||||
_ySpeed = _jumpForce;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user