Bearing markers for remembered hostile contacts, labelled with their claimed classes, and a sweep flash per ping
Entity.RememberedHostiles and ClaimedClasses derive from the book; music and the new markers share RememberedHostiles. Markers sit on the remembered bearing, never the subject's position; Search warnings are collected per tick into sweep flashes. Unity code is not compiled in this commit's verification (dotnet tests only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1ff0e185c5
commit
7b12fbe417
5 changed files with 200 additions and 9 deletions
|
|
@ -2,10 +2,35 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class VisibleTargetIndicator : MonoBehaviour
|
||||
{
|
||||
public RectTransform Transform;
|
||||
public Image Fill;
|
||||
public PlaceUIElementWorldspace Place;
|
||||
public TextMeshProUGUI Label;
|
||||
|
||||
// Null or empty hides the label; the first non-empty text creates it as a child (no scene or prefab edit) and keeps it.
|
||||
// Pools are shared, so hide the label before the indicator returns to its pool.
|
||||
public void ShowLabel(string text)
|
||||
{
|
||||
var show = !string.IsNullOrEmpty(text);
|
||||
if (Label == null)
|
||||
{
|
||||
if (!show) return;
|
||||
var child = new GameObject("Label", typeof(RectTransform));
|
||||
child.transform.SetParent(transform, false);
|
||||
Label = child.AddComponent<TextMeshProUGUI>();
|
||||
Label.fontSize = 14;
|
||||
Label.alignment = TextAlignmentOptions.Top;
|
||||
Label.raycastTarget = false;
|
||||
var rect = Label.rectTransform;
|
||||
rect.anchorMin = rect.anchorMax = new Vector2(.5f, 0);
|
||||
rect.pivot = new Vector2(.5f, 1);
|
||||
rect.sizeDelta = new Vector2(200, 24);
|
||||
}
|
||||
Label.gameObject.SetActive(show);
|
||||
if (show && Label.text != text) Label.text = text;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue