Updates to spells, HUD, Gold, and Camera Controls. New sound effects!

This commit is contained in:
Matt F 2026-07-18 18:12:56 -07:00
parent 689fe7be88
commit a33d951abd
27 changed files with 578 additions and 68 deletions

View file

@ -85,6 +85,7 @@ namespace TD.Gameplay
// Cached reference to the local TowerPaintController, looked up lazily (same
// rationale as the placement controller).
private TowerPaintController cachedPaintController;
private BuilderSpellCastController cachedSpellCastController;
// ----- Lifecycle --------------------------------------------------
@ -120,7 +121,7 @@ namespace TD.Gameplay
// Placement and paint are both modal: while either is active, the local
// controller for that mode owns left-/right-click, so selection here yields.
bool isModal = IsLocalPlayerPlacing() || IsLocalPlayerPainting();
bool isModal = IsLocalPlayerPlacing() || IsLocalPlayerPainting() || IsLocalPlayerAimingSpell();
Vector2 mousePos = mouse.position.ReadValue();
// UI Toolkit dispatches button click events AFTER Update runs, but raw mouse
@ -292,5 +293,21 @@ namespace TD.Gameplay
}
return cachedPaintController.IsPainting;
}
private bool IsLocalPlayerAimingSpell()
{
if (cachedSpellCastController == null)
{
// Find lazily — controller may have been added after this component spawned.
cachedSpellCastController =
UnityEngine.Object.FindAnyObjectByType<BuilderSpellCastController>();
if (cachedSpellCastController == null) return false;
}
// IsAiming covers "aiming, click not yet made"; ConsumedCastClickThisFrame covers the
// frame the confirming click casts and exits aim mode — together they suppress the
// selection click regardless of Update order between the two controllers.
return cachedSpellCastController.IsAiming
|| cachedSpellCastController.ConsumedCastClickThisFrame;
}
}
}