25 lines
511 B
C#
25 lines
511 B
C#
using UnityEngine;
|
|
|
|
public class RotateYNegative360 : MonoBehaviour
|
|
{
|
|
public float duration = 2f; // 2초 동안 회전
|
|
private float timer;
|
|
|
|
private void OnEnable()
|
|
{
|
|
timer = 0f;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
timer += Time.deltaTime;
|
|
float t = Mathf.Clamp01(timer / duration);
|
|
transform.rotation = Quaternion.Euler(0f, -360f * t, 0f);
|
|
|
|
// 한 바퀴 돌면 멈춤
|
|
if (t >= 1f)
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |