first commit

This commit is contained in:
2026-06-04 15:09:10 +03:00
commit c94f0cc648
62 changed files with 9224 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
using UnityEngine;
using UnityEngine.UI;
public class ZoneUI : MonoBehaviour
{
public CaptureZone zone;
public Slider progressSlider;
public Text labelText;
public Image fillImage;
public Camera targetCamera;
public Color neutralColor = Color.gray;
public Color playerColor = new Color(0.2f, 0.45f, 1f);
public Color enemyColor = new Color(1f, 0.2f, 0.15f);
public Color contestedColor = new Color(1f, 0.82f, 0.08f);
private void LateUpdate()
{
if (zone == null)
{
return;
}
if (progressSlider != null)
{
progressSlider.value = zone.GetProgress();
}
Color color = GetColorForZone();
if (fillImage != null)
{
fillImage.color = color;
}
if (labelText != null)
{
labelText.text = zone.zoneName + ": " + zone.GetOwner();
labelText.color = color;
}
Camera cameraToUse = targetCamera != null ? targetCamera : Camera.main;
if (cameraToUse != null)
{
transform.rotation = Quaternion.LookRotation(transform.position - cameraToUse.transform.position, Vector3.up);
}
}
private Color GetColorForZone()
{
CaptureZone.CaptureState state = zone.GetCaptureState();
if (state == CaptureZone.CaptureState.Contested ||
state == CaptureZone.CaptureState.CapturingByPlayer ||
state == CaptureZone.CaptureState.CapturingByEnemy)
{
return contestedColor;
}
if (zone.GetOwner() == CaptureZone.Owner.Player)
{
return playerColor;
}
if (zone.GetOwner() == CaptureZone.Owner.Enemy)
{
return enemyColor;
}
return neutralColor;
}
}