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

@ -24,8 +24,9 @@ namespace TD.Gameplay.BuilderSpells
/// <para><b>Server-only resolution, client-only visual.</b> <see cref="ServerCast"/> runs on
/// the server and applies damage/status via the same <c>Physics.OverlapSphereNonAlloc</c> +
/// <c>EnemyHealth</c>/<c>EnemyStatus</c> pattern <c>TowerCombat</c> already uses.
/// <see cref="ClientPlayVfx"/> runs on every peer (including the server) after a successful
/// cast, purely for presentation.</para>
/// Presentation is split into <see cref="ClientSpawnVfx"/> (on cast) and
/// <see cref="ClientPlayImpact"/> (on contact, <see cref="ImpactDelay"/> seconds later for a
/// projectile spell), both running on every peer including the server.</para>
/// </remarks>
public abstract class BuilderSpellDefinition : ScriptableObject
{
@ -82,10 +83,28 @@ namespace TD.Gameplay.BuilderSpells
public abstract bool ServerCast(ulong clientId, Vector3 targetPoint);
/// <summary>
/// Runs on every peer (via <see cref="PlayerSpellLoadout"/>'s ClientRpc) after a
/// successful <see cref="ServerCast"/>. Default no-op; override to spawn an impact VFX
/// prefab and self-destroy it, the same idiom used elsewhere for one-off visuals.
/// Seconds between the cast and the effect landing. 0 = instant: damage and the impact
/// sound resolve immediately on cast. A projectile-style spell (e.g. the Fireball meteor)
/// overrides this with its fall/travel time, so <see cref="PlayerSpellLoadout"/> spawns the
/// visual on cast but holds <see cref="ServerCast"/> (damage) and <see cref="ClientPlayImpact"/>
/// (sound) until the projectile reaches the ground. Set it to match the VFX's fall time.
/// </summary>
public virtual void ClientPlayVfx(Vector3 targetPoint) { }
public virtual float ImpactDelay => 0f;
/// <summary>
/// Runs on every peer (via <see cref="PlayerSpellLoadout"/>'s ClientRpc) the moment the
/// spell is cast. Spawns the visual: for an instant spell that's the whole effect; for a
/// delayed spell it's the projectile/travel visual that lands after <see cref="ImpactDelay"/>.
/// Default no-op.
/// </summary>
public virtual void ClientSpawnVfx(Vector3 targetPoint) { }
/// <summary>
/// Runs on every peer when the spell makes contact — immediately for an instant spell, or
/// <see cref="ImpactDelay"/> seconds after cast for a delayed one. Play the impact sound
/// (and any impact-moment visual) here so it lands with the effect, not the throw.
/// Default no-op.
/// </summary>
public virtual void ClientPlayImpact(Vector3 targetPoint) { }
}
}