using UnityEngine;
using UnityEngine.Events;

public class InputControllerPlayer : MonoBehaviour, ISubscriberInput
{
    public UnityEvent butLeftPress;
    public UnityEvent butLeftRelease;
    public UnityEvent butRightPress;
    public UnityEvent butRightRelease;
    public UnityEvent butUp;

    // Start is called before the first frame update
    private void Start()
    {
        subscribe();
    }

    public void subscribe()
    {
        GameObject.FindGameObjectsWithTag("InputManager")[0].GetComponent<GameInput_Manager>().subscribe(gameObject);
    }

    public void notifyInput(EnumActionCommand command)
    {
        switch (command)
        {
            case EnumActionCommand.LEFT_PRESS:
                butLeftPress.Invoke();
                break;
            case EnumActionCommand.LEFT_RELEASE:
                butLeftRelease.Invoke();
                break;
            case EnumActionCommand.RIGHT_PRESS:
                butRightPress.Invoke();
                break;
            case EnumActionCommand.RIGHT_RELEASE:
                butRightRelease.Invoke();
                break;
            case EnumActionCommand.UP_PRESS:
                butUp.Invoke();
                break;
            default:
                break;
        }
    }

    
}
