Хочу плавно открывать дверь, но код почему-то не работает
using UnityEngine;
public class Door : MonoBehaviour
{
[SerializeField] private int _angle;
[SerializeField] private Transform _root;
[SerializeField] private State _state;
enum State
{
Standart,
Open,
}
private void OnMouseDown()
{
if(_state == State.Standart)
{
_root.eulerAngles = Vector3.Lerp(transform.eulerAngles, transform.eulerAngles + Vector3.up * _angle, 1000);
_state = State.Open;
}
else
{
_root.eulerAngles = Vector3.Lerp(transform.eulerAngles, transform.eulerAngles - Vector3.up * _angle, 1000);
_state = State.Standart;
}
}
}