Files

29 lines
797 B
C#
Raw Permalink Normal View History

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;
transform.RotateTween( Vector3.forward , rotation , animTime).SetEase(ease).SetOnComplete( Rotate );
}
}
}