Add utils + refacto
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user