using UnityEngine;
using System.Collections;

[RequireComponent(typeof(AnimationManager))]
public class PlayerInputDisplay : MonoBehaviour
{

    public enum State
    {
        NullMove,
        AttackPending,
        Attack,
        DefendPending,
        Defend,
        RitualPending,
        Ritual,
    }

    private AnimationManager _animationManager;

    void Awake()
    {
        _animationManager = GetComponent<AnimationManager>();
    }

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    public void SetPendingMove(PlayerController.MoveType? move)
    {
        if (move == null)
        {
            SetState(State.NullMove);
            return;
        }

        switch (move)
        {
            case PlayerController.MoveType.Attack:
                SetState(State.AttackPending);
                break;

            case PlayerController.MoveType.Defend:
                SetState(State.DefendPending);
                break;

            case PlayerController.MoveType.Ritual:
                SetState(State.RitualPending);
                break;
        }
    }

    public void SetActiveMove(PlayerController.MoveType? move)
    {
        if (move == null)
        {
            SetState(State.NullMove);
            return;
        }

        switch (move)
        {
            case PlayerController.MoveType.Attack:
                SetState(State.Attack);
                break;

            case PlayerController.MoveType.Defend:
                SetState(State.Defend);
                break;

            case PlayerController.MoveType.Ritual:
                SetState(State.Ritual);
                break;
        }
    }

    public void SetState(State state)
    {
        _animationManager.SetState((int)state);
    }
}
