Major updates to the HUD and selectable objects
This commit is contained in:
parent
5bc757b385
commit
c100db52e5
23 changed files with 1615 additions and 614 deletions
46
Assets/_Project/Scripts/Gameplay/ISelectable.cs
Normal file
46
Assets/_Project/Scripts/Gameplay/ISelectable.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Assets/_Project/Scripts/Gameplay/ISelectable.cs
|
||||
using UnityEngine;
|
||||
|
||||
namespace TD.Gameplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Categorizes the kind of selectable object so HUD can decide which command
|
||||
/// buttons (tower-build vs upgrade/sell vs none) to show without doing
|
||||
/// type-tests against every concrete component.
|
||||
/// </summary>
|
||||
public enum SelectableKind
|
||||
{
|
||||
Builder,
|
||||
Tower,
|
||||
Enemy,
|
||||
BuildSite, // tower in queued / constructing / paused / shelved state
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Anything the local player can click to select. Implementers expose a
|
||||
/// display name for the HUD portrait, a kind for context-aware UI, and the
|
||||
/// position + size hints the <see cref="SelectionVisualizer"/> needs to draw
|
||||
/// the selection ring.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Selection is a local UI concept — implementers don't need to be
|
||||
/// NetworkBehaviours (though Builder and TowerInstance happen to be).
|
||||
/// </remarks>
|
||||
public interface ISelectable
|
||||
{
|
||||
string DisplayName { get; }
|
||||
SelectableKind Kind { get; }
|
||||
|
||||
/// <summary>Transform whose XZ position the scene-wide selection ring
|
||||
/// follows. The visualizer projects Y to the buildable plane regardless
|
||||
/// of where this transform sits, so implementers can simply return
|
||||
/// <c>this.transform</c>.</summary>
|
||||
Transform SelectionTransform { get; }
|
||||
|
||||
/// <summary>Half-width of the selection ring in world units. The visualizer
|
||||
/// scales its base 1-unit-diameter ring mesh to <c>2 * SelectionRadius</c>.
|
||||
/// Computed on every selection change, so implementers may derive it from
|
||||
/// runtime state (e.g., tower footprint, collider bounds).</summary>
|
||||
float SelectionRadius { get; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue