using System.Collections; 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(); transform.rotation = Quaternion.Euler(0, 0, RotationZ + Image.fillAmount * -180); } private void Update() { transform.rotation = Quaternion.Euler(0, 0, RotationZ + Image.fillAmount * -180); } /// /// 레이더 타겟 초기화 (노란색 부분) /// /// 위치 조절 /// 크기 조절 0.1 = 360의 10퍼센트 public void RadarTargetInit(float rotation, float fillAmount) { RotationZ = rotation; Image.fillAmount = fillAmount; } public void Reactivate() { RadarTargetInit(Random.Range(0f, 360f), Random.Range(0.1f, 0.2f)); if (!transform.gameObject.activeSelf) { transform.gameObject.SetActive(true); } } } }