2026-05-21 23:37:34 +09:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace VRBeats
|
|
|
|
|
{
|
|
|
|
|
public class RandomizeRotation : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField] private float minRotation = 0.0f;
|
|
|
|
|
[SerializeField] private float maxRotation = 0.0f;
|
|
|
|
|
[SerializeField] private Ease ease = Ease.EaseOutExpo;
|
|
|
|
|
[SerializeField] private float animTime = 2.0f;
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
animTime = Random.Range(animTime / 2.0f , animTime);
|
|
|
|
|
|
|
|
|
|
Rotate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Rotate()
|
|
|
|
|
{
|
2026-05-26 18:54:56 +09:00
|
|
|
float direction = Random.value < 0.5f ? -1.0f : 1.0f;
|
|
|
|
|
float rotation = Random.Range(minRotation, maxRotation) * direction;
|
2026-05-21 23:37:34 +09:00
|
|
|
transform.RotateTween( Vector3.forward , rotation , animTime).SetEase(ease).SetOnComplete( Rotate );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|