Add utils + refacto

This commit is contained in:
2026-01-30 17:39:26 +01:00
parent 9ff17b5305
commit 23d3cb5d2c
29 changed files with 675 additions and 461 deletions
@@ -1,16 +1,12 @@
using UnityEngine;
using Unheimlich.Core;
using Unheimlich.Managers;
namespace Unheimlich.Gameplay.Player
{
/// <summary>
/// Handles player movement, jumping, and gravity using CharacterController.
/// Provides movement state information for other systems like camera head bob.
/// </summary>
[RequireComponent(typeof(CharacterController))]
public class PlayerMovement : MonoBehaviour
public class PlayerMovement : Singleton<PlayerMovement>
{
public static PlayerMovement Instance { get; private set; }
[Header("Settings")]
[SerializeField] private float _moveSpeed = 5f;
@@ -24,15 +20,8 @@ namespace Unheimlich.Gameplay.Player
private float _ySpeed;
private Vector3 _moveDirection;
private void Awake()
protected override void OnAwake()
{
if (Instance != null && Instance != this)
{
Destroy(this);
return;
}
Instance = this;
CharacterController = GetComponent<CharacterController>();
}