Добавлено базовое перемещение, тестовый материал
This commit is contained in:
1 parent
86c9c126a6
commit
8981457f2d
35 files changed
+1052
-6
No files matched your search
@@ -2,12 +2,15 @@ using Code.Gameplay.Player;
|
||||
using Code.Input;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
using CharacterController = Code.Gameplay.Player.CharacterController;
|
||||
|
||||
public class Player : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private PlayerCamera playerCamera;
|
||||
[SerializeField]
|
||||
private CharacterController characterController;
|
||||
[SerializeField]
|
||||
private Transform cameraFollowPoint;
|
||||
[Inject] private IInputService _inputService;
|
||||
|
||||
@@ -27,6 +30,24 @@ public class Player : MonoBehaviour
|
||||
new Vector3(lookInput.x, lookInput.y, 0));
|
||||
}
|
||||
|
||||
private void HandleCharacterInput()
|
||||
{
|
||||
PlayerInputs inputs = new PlayerInputs();
|
||||
|
||||
Vector2 moveInput = _inputService.MoveInput;
|
||||
inputs.MoveAxisForward = moveInput.y;
|
||||
inputs.MoveAxisRight = moveInput.x;
|
||||
|
||||
inputs.CameraRotation = playerCamera.transform.rotation;
|
||||
|
||||
characterController.SetInputs(ref inputs);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
HandleCharacterInput();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
HandleCameraInput();
|
||||
|
||||
Reference in new issue
Block a user