new input system movement

This commit is contained in:
Vova
2024-01-04 08:48:04 +02:00
parent 95b2e13de8
commit 72c24ac8a7
6 changed files with 339 additions and 103 deletions
+5 -7
View File
@@ -1,9 +1,6 @@
using System;
using UnityEngine;
public class Player : Character
{
[SerializeField]
@@ -30,10 +27,11 @@ public class Player : Character
private GameObject _hammer;
private bool _isHoldingHammer = true;
public event EventHandler<TreasureType> OnPlayerTakeItem;
public InputActions _inputActions = new InputActions();
private void Awake()
{
if (Instance != null)
@@ -45,8 +43,7 @@ public class Player : Character
PlayerPrefs.SetString("lastExitName", string.Empty);
Instance = this;
DontDestroyOnLoad(gameObject);
_inputActions.Enable();
}
public void AddCoin()
@@ -88,7 +85,8 @@ public class Player : Character
_animator.SetTrigger("Body_ThrowHammer");
}
}
base.MoveTo(Input.GetAxisRaw("Horizontal"), isAllowVertical? Input.GetAxisRaw("Vertical"):0);
var move=_inputActions.Player.Movement.ReadValue<Vector2>();
base.MoveTo(move.x, isAllowVertical? move.y:0);
}
public void ThrowHammerObject()