using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace Nan.Scripts
{
    public class PlayerPresenter : MonoBehaviour
    {
        [SerializeField] private Animator animator;

        private void Start()
        {

        }
        
        private void Update()
        {
            var stick = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
            var value = (Mathf.Atan2(-stick.x, stick.y) / Mathf.PI / 2 + 0.5f) * 8;
            animator.SetFloat("Blend", value);
        }

        public void ShowDeathAnimation()
        {
            animator.SetTrigger("Death");
        }
    }
}