ReisenTasker/Assets/Scripts/Entity/Player.cs

43 lines
1 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;
public class Player : CombatEntity
{
//[Header("Input")]
//private InputAction moveAction;
/*private void Start()
{
//moveAction = InputSystem.actions.FindAction("Move");
}*/
[Header("Abilities")]
public bool abilitiesDisabled;
public List<PlayerAbility> abilities = new();
protected override void Movement()
{
base.Movement();
//Debug.Log(moveAction.actionMap);
//moveDirection = moveAction.ReadValue<Vector2>();
moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
}
private void Update()
{
foreach (PlayerAbility ability in abilities)
{
if (Input.GetKeyDown(ability.inputKey))
{
ability.TryAbility();
}
else if (ability.inputKey == KeyCode.None && Input.GetMouseButtonDown((int)ability.mouseButton))
{
//really needs to be fixed to the new input system
ability.TryAbility();
}
}
}
}