shitty looking AOE effect for slow area

This commit is contained in:
Ian Woods 2026-07-17 00:03:36 -07:00
parent fe2c59d326
commit 689fe7be88
8 changed files with 2778 additions and 5 deletions

View file

@ -1,5 +1,6 @@
// Assets/_Project/Scripts/Gameplay/BuilderSpells/SlowAreaSpellDefinition.cs
using UnityEngine;
using TD.Audio;
using TD.Core;
namespace TD.Gameplay.BuilderSpells
@ -19,6 +20,15 @@ namespace TD.Gameplay.BuilderSpells
{
public override BuilderSpellKind Kind => BuilderSpellKind.SlowArea;
[Header("Area VFX")]
[Tooltip("Prefab spawned at the target point on a successful cast, authored at a 1-unit " +
"radius — scaled up to match Radius here. Lives for EffectDuration, matching " +
"how long the slow itself lasts. Optional — leave empty for no visual.")]
[SerializeField] private GameObject areaVfxPrefab;
[Tooltip("Sound played on every peer when this spell resolves successfully.")]
[SerializeField] private SoundConfig areaSound;
[Header("Slow Area")]
[Tooltip("Speed multiplier applied to affected enemies for EffectDuration " +
"(e.g. 0.5 = half speed).")]
@ -51,5 +61,19 @@ namespace TD.Gameplay.BuilderSpells
return hitAny;
}
public override void ClientPlayVfx(Vector3 targetPoint)
{
if (areaVfxPrefab != null)
{
var instance = Instantiate(areaVfxPrefab, targetPoint, Quaternion.identity);
instance.transform.localScale *= Mathf.Max(Radius, 0.01f);
Destroy(instance, EffectDuration);
}
if (areaSound.clip != null)
AudioManager.Instance?.Play(areaSound.clip, AudioCategory.Combat,
areaSound.RandomPitch(), areaSound.volume);
}
}
}