21 lines
665 B
C#
21 lines
665 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class RadarNeedle : MonoBehaviour
|
|
{
|
|
[field: SerializeField]
|
|
[field: Tooltip("바늘 회전 속도 \n 360 = 1초에 1바퀴 \n 음수는 시계방향")]
|
|
public float RotationSpeed { get; set; }
|
|
private float currentRotationZ = 0f;
|
|
|
|
private void Update()
|
|
{
|
|
currentRotationZ += RotationSpeed * Time.deltaTime;
|
|
currentRotationZ = currentRotationZ % 360; // 360을 초과하지 않도록
|
|
transform.eulerAngles = new Vector3(0, 0, currentRotationZ);
|
|
}
|
|
}
|
|
} |