2026-06-19 UI, UI로직
This commit is contained in:
46
Assets/My project/Fishing Scripts/UI/RotateUI.cs
Normal file
46
Assets/My project/Fishing Scripts/UI/RotateUI.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class RotateUI : MonoBehaviour
|
||||
{
|
||||
[Header("Rotation Settings")]
|
||||
[SerializeField] private float rotateSpeed = 30f;
|
||||
[SerializeField] private bool clockwise = true;
|
||||
[SerializeField] private bool playOnStart = true;
|
||||
|
||||
private bool isRotating;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
isRotating = playOnStart;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isRotating)
|
||||
return;
|
||||
|
||||
float dir = clockwise ? -1f : 1f;
|
||||
|
||||
transform.Rotate(0f, 0f, dir * rotateSpeed * Time.deltaTime, Space.Self);
|
||||
}
|
||||
|
||||
public void StartRotate()
|
||||
{
|
||||
isRotating = true;
|
||||
}
|
||||
|
||||
public void StopRotate()
|
||||
{
|
||||
isRotating = false;
|
||||
}
|
||||
|
||||
public void SetClockwise(bool value)
|
||||
{
|
||||
clockwise = value;
|
||||
}
|
||||
|
||||
public void ResetRotation()
|
||||
{
|
||||
transform.localEulerAngles = Vector3.zero;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user