This commit is contained in:
2024-10-14 10:30:38 +02:00
commit ec487096bf
167 changed files with 16245 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : BasicCharacter {
[SerializeField] private InputActionAsset _inputAsset;
[SerializeField] private InputActionReference _movementAction;
protected override void Awake() {
base.Awake();
if (_inputAsset == null) return;
}
private void OnEnable() {
if (_inputAsset == null) return;
_inputAsset.Enable();
}
private void OnDisable() {
if (_inputAsset == null) return;
_inputAsset.Disable();
}
private void Update() {
HandleMovementInput();
}
void HandleMovementInput() {
if (_movementBehaviour == null ||
_movementAction == null)
return;
//movement
float movementInput = _movementAction.action.ReadValue<float>();
Vector3 movement = movementInput * Vector3.right;
_movementBehaviour.DesiredMovementDirection = movement;
}
}