using UnityEngine; // 入力を読み取り、移動・攻撃・カメラへ処理を渡す public class PlayerController : MonoBehaviour { [SerializeField] private PlayerMove playerMove; [SerializeField] private CameraMove cameraMove; [SerializeField] private CharacterAttack characterAttack; private InputSystem_Actions _inputActions; private void Awake() { _inputActions = new InputSystem_Actions(); } private void OnEnable() { _inputActions.Player.Enable(); } private void OnDisable() { _inputActions.Player.Disable(); } private void Update() { var moveInput = _inputActions.Player.Move.ReadValue(); var lookInput = _inputActions.Player.Look.ReadValue(); cameraMove.Look(lookInput); if (_inputActions.Player.Attack.WasPressedThisFrame()) characterAttack.Attack(); if (characterAttack.IsAttacking) return; var direction = cameraMove.PlanarForward * moveInput.y + cameraMove.PlanarRight * moveInput.x; playerMove.Move(Vector3.ClampMagnitude(direction, 1f)); } }