2023-09-11 05:15:18 +00:00
|
|
|
using System.Collections;
|
2023-09-11 01:55:36 +00:00
|
|
|
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>();
|
2023-09-11 05:15:18 +00:00
|
|
|
transform.rotation = Quaternion.Euler(0, 0, RotationZ + Image.fillAmount * -180);
|
2023-09-11 01:55:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2023-09-11 05:15:18 +00:00
|
|
|
|
|
|
|
public void Reactivate()
|
|
|
|
{
|
|
|
|
RadarTargetInit(Random.Range(0f, 360f), Random.Range(0.1f, 0.2f));
|
2023-09-12 05:37:15 +00:00
|
|
|
if (!transform.gameObject.activeSelf)
|
|
|
|
{
|
|
|
|
transform.gameObject.SetActive(true);
|
|
|
|
}
|
2023-09-11 05:15:18 +00:00
|
|
|
}
|
2023-09-11 01:55:36 +00:00
|
|
|
}
|
|
|
|
}
|