Essentials + extra crap

Loadings
Startups
Movement
Camera
This commit is contained in:
ThomasCharester committed 2026-01-12 18:43:51 +03:00
1 parent 662f4a1d05
commit 5f5ace1b52
734 files changed
+107323 -1713

No files matched your search

@@ -0,0 +1,18 @@
using KinematicCharacterController;
using UnityEngine;
namespace Code.Example.Liminal.Player
{
public class PlayerAnimator : MonoBehaviour
{
private static readonly int Velocity = Animator.StringToHash("Velocity");
[SerializeField] private Animator animator;
[SerializeField] private KinematicCharacterMotor characterMotor;
private void Update()
{
animator.SetFloat(Velocity, characterMotor.Velocity.magnitude);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e79636518658432a99481e476aeebc66
timeCreated: 1766610269
@@ -0,0 +1,7 @@
namespace Code.Example.Liminal.Player
{
public class PlayerFactory
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 60b7c1aa1c8c4189a2b442d2b4c628eb
timeCreated: 1766652945
@@ -0,0 +1,74 @@
using System;
using Code.Example.Liminal.Character;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Camera.CameraStates;
using Code.Infrastructure.Input;
using Reflex.Attributes;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Code.Example.Liminal.Player
{
public class PlayerMovementController : MonoBehaviour
{
[SerializeField] private LiminalCharacterController characterController;
private PlayerCharacterInputs _currentInputs = new();
private IInputService _inputService;
private CameraStateMachine _cameraStateMachine;
public Transform PlayerHeadPoint;
[Inject]
private void Construct(IInputService inputService, CameraStateMachine stateMachine)
{
_inputService = inputService;
_inputService.BindActionPerformed((int) ActionMappings.Gameplay, (int) GameplayActions.Move, OnMovePerformed);
_inputService.BindActionCancel((int) ActionMappings.Gameplay, (int) GameplayActions.Move, OnMoveCanceled);
_inputService.BindActionPerformed((int) ActionMappings.Gameplay, (int) GameplayActions.Crouch, OnCrouchPerformed);
_inputService.BindActionCancel((int) ActionMappings.Gameplay, (int) GameplayActions.Crouch, OnCrouchCanceled);
_cameraStateMachine = stateMachine;
((FirstPersonCameraState)stateMachine.CurrentBaseState).SetPlayer(this);
}
private void Awake()
{
_currentInputs.MoveAxisForward = 0;
_currentInputs.MoveAxisRight = 0;
_currentInputs.CrouchUp = true;
_currentInputs.CrouchDown = false;
_currentInputs.CameraRotation = Quaternion.identity;
}
public void SetCameraRotation(Quaternion rotation) => _currentInputs.CameraRotation = rotation;
private void OnMovePerformed(InputAction.CallbackContext context)
{
_currentInputs.MoveAxisForward = context.ReadValue<Vector2>().y;
_currentInputs.MoveAxisRight = context.ReadValue<Vector2>().x;
}
private void OnMoveCanceled(InputAction.CallbackContext context)
{
_currentInputs.MoveAxisForward = 0;
_currentInputs.MoveAxisRight = 0;
}
private void OnCrouchPerformed(InputAction.CallbackContext context)
{
_currentInputs.CrouchDown = true;
_currentInputs.CrouchUp = false;
}
private void OnCrouchCanceled(InputAction.CallbackContext context)
{
_currentInputs.CrouchUp = true;
_currentInputs.CrouchDown = false;
}
private void Update()
{
characterController.SetInputs(_currentInputs);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8dd688d33c434f999d0ff7cd0553f1ee
timeCreated: 1766611089