UITK HUD rework + build palette (click-to-place ghost)
Rebuild the in-game HUD on UI Toolkit (HudUi/HudSystem, Aether palette) consistent with the menu; build-palette bar (BuildPaletteState) drives cursor->cell ground-ghost preview (green/red via BuildPreviewMath), left-click place / right-click cancel / rotate; fire suppressed in build mode; combat juice restyle. +4 BuildPreviewMath EditMode tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Pure validity check for the client build-placement PREVIEW (the ground-ghost colour) — the same legality
|
||||
/// the server re-validates authoritatively in BuildPlaceSystem, computed client-side so the ghost can read
|
||||
/// green (valid) vs red (why-not). No managed types / RNG / wall-clock → unit-testable. The caller supplies
|
||||
/// the live occupancy result + the affordability inputs (it owns the structure scan + the ledger read).
|
||||
/// </summary>
|
||||
public static class BuildPreviewMath
|
||||
{
|
||||
public const byte Valid = 0;
|
||||
public const byte OutOfPlot = 1;
|
||||
public const byte Occupied = 2;
|
||||
public const byte Unaffordable = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate placement at <paramref name="cell"/>: must be in-plot, unoccupied, and affordable.
|
||||
/// <paramref name="occupied"/> = the caller's live-structure cell check; <paramref name="have"/>/<paramref name="cost"/>
|
||||
/// the resource on hand vs the catalog cost. Returns the first failing reason, else <see cref="Valid"/>.
|
||||
/// </summary>
|
||||
public static byte Evaluate(in BaseAnchor anchor, int2 cell, bool occupied, int have, int cost)
|
||||
{
|
||||
if (!BaseGridMath.IsCellInPlot(anchor, cell)) return OutOfPlot;
|
||||
if (occupied) return Occupied;
|
||||
if (have < cost) return Unaffordable;
|
||||
return Valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4deb41f803f65bd4b946354e4a2adcf2
|
||||
Reference in New Issue
Block a user