OldBlueWater/BlueWater/Assets/02.Scripts/Ui/RadarTargetUI.cs
2023-09-11 10:55:36 +09:00

34 lines
928 B
C#

using UnityEngine;
using UnityEngine.UI;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class RadarTargetUI : MonoBehaviour
{
public float RotationZ { get; private set; }
public Image Image { get; private set; }
private void OnEnable()
{
Image = GetComponent<Image>();
}
private void Update()
{
transform.rotation = Quaternion.Euler(0, 0, RotationZ + Image.fillAmount * -180);
}
/// <summary>
/// 레이더 타겟 초기화 (노란색 부분)
/// </summary>
/// <param name="rotation">위치 조절</param>
/// <param name="fillAmount">크기 조절 0.1 = 360의 10퍼센트</param>
public void RadarTargetInit(float rotation, float fillAmount)
{
RotationZ = rotation;
Image.fillAmount = fillAmount;
}
}
}