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

public class CharacterLooking : MonoBehaviour
{
    [SerializeField] protected Transform _pivotY;
    protected Transform _pivotX;
    protected float _yrot;

    private void Awake()
    {
        _pivotX = transform;
    }

    public void LookX(float v)
    {
        _pivotX.transform.rotation *= Quaternion.Euler(transform.up * v);
    }

    public void LookY(float v)
    {
        _yrot = Mathf.Clamp(_yrot + v, -90f, 90f);
        Vector3 euler = _pivotY.transform.localEulerAngles;
        euler.x = _yrot;
        _pivotY.transform.localEulerAngles = euler;
    }
}
