Adding Text Mesh Pro, new enemies, new enemy waves, new HUD functionality, New animators, a retry function, and floating text for gold earned and lives lost.

This commit is contained in:
Matt F 2026-05-13 17:39:16 -07:00
parent 3287e8ea43
commit f6cc6a7102
110 changed files with 62003 additions and 251 deletions

View file

@ -0,0 +1,76 @@
// Assets/_Project/Scripts/Dev/DevWaveControls.cs
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using TD.Gameplay;
namespace TD.Dev
{
/// <summary>
/// Editor / testing convenience: shows an OnGUI button in the top-left
/// corner that force-advances the wave on the server. Add this component
/// to any GameObject in the scene (e.g. a "DevTools" empty) during testing,
/// disable or remove for shipping builds.
/// </summary>
/// <remarks>
/// The button calls <see cref="WaveManager.ForceAdvanceToNextWave"/>, which
/// despawns active enemies, stops the current wave's coroutine, and starts
/// the next wave with no prep delay.
///
/// Server-side only — the OnGUI button is gated to <c>NetworkManager.IsServer</c>
/// so clients connected to a remote host don't see it. The hotkey path is
/// also server-gated to avoid surprising results when pressed on a client.
/// </remarks>
public class DevWaveControls : MonoBehaviour
{
[Tooltip("Keyboard shortcut to force-advance to the next wave. " +
"Uses the new Input System (UnityEngine.InputSystem.Key). " +
"Set to Key.None to use the OnGUI button only.")]
[SerializeField] private Key hotkey = Key.F9;
private void Update()
{
if (hotkey == Key.None) return;
var kb = Keyboard.current;
if (kb == null) return; // no keyboard connected (e.g. headless server)
if (!kb[hotkey].wasPressedThisFrame) return;
TryForceNextWave();
}
private void OnGUI()
{
// Only show the button on the server (host or dedicated). Clients
// calling this from afar would no-op anyway.
if (NetworkManager.Singleton == null || !NetworkManager.Singleton.IsServer)
return;
// Anchored below the top HUD bar so it doesn't overlap gold/wave/lives.
const float topOffset = 90f;
GUI.Box(new Rect(10, topOffset, 180, 60), "Dev: Wave Controls");
if (GUI.Button(new Rect(20, topOffset + 25, 160, 28), "Force Next Wave"))
TryForceNextWave();
}
private void TryForceNextWave()
{
if (NetworkManager.Singleton == null || !NetworkManager.Singleton.IsServer)
{
Debug.LogWarning("[DevWaveControls] Force-advance requested off the server. Ignored.");
return;
}
var wm = WaveManager.Instance;
if (wm == null)
{
Debug.LogWarning("[DevWaveControls] WaveManager.Instance is null. " +
"Is the scene running with a WaveManager network-spawned?");
return;
}
Debug.Log("[DevWaveControls] Forcing next wave.");
wm.ForceAdvanceToNextWave();
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 468de2ce61e73ce4595ba4792874b076