using UnityEngine;

namespace NBF
{
    public class PlayerChest : MonoBehaviour
    {
        private const int MaxFixEyeAngle = 15;
        private const int MinFixEyeAngle = -10;

        private void LateUpdate()
        {
            FixArmAngle();
        }

        private void FixArmAngle()
        {
            var angle = FPlayerData.Instance.EyeAngle;
            
            if (angle > MaxFixEyeAngle) angle = MaxFixEyeAngle;
            else if (angle < MinFixEyeAngle) angle = MinFixEyeAngle;
            var val = transform.localEulerAngles;
            transform.localEulerAngles = new Vector3(val.x, val.y, val.z - angle);
        }
    }
}