trotFunky
ea9203ca8a
AbstractCharacter mainly fleshed out InputManager is done Player movement is done, not ennemy Energy management is done (AbstractCharacter)
35 lines
749 B
C#
35 lines
749 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class InputManager : MonoBehaviour
|
|
{
|
|
|
|
private AbstractCharacter _character;
|
|
void Start()
|
|
{
|
|
_character = GetComponentInParent<AbstractCharacter>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
//
|
|
// Manage movement inputs
|
|
//
|
|
var movementDirection = Vector2.zero;
|
|
|
|
movementDirection += Input.GetAxis("Horizontal") * Vector2.right;
|
|
movementDirection += Input.GetAxis("Vertical") * Vector2.up;
|
|
|
|
_character.Move(movementDirection);
|
|
|
|
//
|
|
// Manage action inputs
|
|
//
|
|
|
|
if (Input.GetButton("Fire1"))
|
|
{
|
|
_character.Shoot();
|
|
}
|
|
}
|
|
}
|