using UnityEngine;
using System.Collections;

public enum TurnCommand { None, Left, Right }

public class InputHandler : MonoBehaviour {

    public KeyCode keyCodeTurnLeft = KeyCode.LeftArrow;
    public KeyCode keyCodeTurnRight = KeyCode.RightArrow;

    private TurnCommand currentTurnCommand = TurnCommand.None;

    public bool HasTurnCommand(TurnCommand cmd) {
        return currentTurnCommand == cmd;
    }

    public void Update() {
        currentTurnCommand = TurnCommand.None;

        TestKey(keyCodeTurnLeft, TurnCommand.Left);
        TestKey(keyCodeTurnRight, TurnCommand.Right);
    }

    private void TestKey(KeyCode keyCode, TurnCommand command) {
        if (Input.GetKeyDown(keyCode)) {
            currentTurnCommand = command;
        }
    }

}
