wip: PlayerMover

This commit is contained in:
2026-09-30 18:39:14 +02:00
parent 2cf9ae719a
commit 074eb51084
11 changed files with 352 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
using UnityEngine;
[ExecuteAlways]
public class CameraFollower : MonoBehaviour
{
public GameObject Player;
void Update()
{
if (Player)
transform.position = Player.transform.position;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4ae4fbdc595247448b3d604825bd07fe

View File

@@ -0,0 +1,53 @@
using System.ComponentModel;
using UnityEngine;
public class PlayerMover : MonoBehaviour
{
[System.Serializable]
private class Settings
{
public float Speed = 5;
}
[System.Serializable]
private struct References
{
public CharacterController Controller;
}
[System.Serializable]
public class StateContainer
{
public bool IsJumping = false;
}
#region FIELDS
const float MS_TO_KMH = 1 / 3.6f;
[SerializeField] private Settings _settings;
[SerializeField] private References _references;
[SerializeField] private StateContainer _state;
public StateContainer State => _state;
#endregion
#region UNITY LIFECYCLES
void Update()
{
float t = Time.deltaTime;
Move(t);
}
private void Move(float t)
{
transform.position += Vector3.forward * t * MS_TO_KMH * _settings.Speed;
}
#endregion
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 502392351c6ed7e4c9a3a895792f5b68