Merge branch 'fireball-vfx'
This commit is contained in:
commit
826d7b5037
12 changed files with 3121 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// Assets/_Project/Scripts/Gameplay/BuilderSpells/FireballSpellDefinition.cs
|
||||
using UnityEngine;
|
||||
using TD.Audio;
|
||||
using TD.Core;
|
||||
|
||||
namespace TD.Gameplay.BuilderSpells
|
||||
|
|
@ -10,7 +11,7 @@ namespace TD.Gameplay.BuilderSpells
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="BuilderSpellDefinition.TargetType"/> is <see cref="SpellTargetType.PointTarget"/>
|
||||
/// — the cast controller shows only a fixed-size reticle, even though
|
||||
/// — the cast controller shows only a fixed-size reticule, even though
|
||||
/// <see cref="BuilderSpellDefinition.Radius"/> is still used internally here as the splash
|
||||
/// radius (0 = no splash, direct hit only).
|
||||
/// </remarks>
|
||||
|
|
@ -19,6 +20,20 @@ namespace TD.Gameplay.BuilderSpells
|
|||
{
|
||||
public override BuilderSpellKind Kind => BuilderSpellKind.Fireball;
|
||||
|
||||
[Header("Impact VFX")]
|
||||
[Tooltip("Prefab spawned at the target point on a successful cast. Optional — leave empty for no visual.")]
|
||||
[SerializeField] private GameObject impactVfxPrefab;
|
||||
|
||||
[Tooltip("Seconds before the spawned VFX instance is destroyed.")]
|
||||
[Min(0f)]
|
||||
[SerializeField] private float impactVfxLifetime = 2f;
|
||||
|
||||
[Header("Impact Sound")]
|
||||
[Tooltip("Sound played on every peer when this spell resolves successfully. Same " +
|
||||
"SoundConfig struct TowerBuiltSound uses — reuse a tower's clip directly if " +
|
||||
"you want the same sound.")]
|
||||
[SerializeField] private SoundConfig impactSound;
|
||||
|
||||
[Header("Fireball")]
|
||||
[Tooltip("Damage dealt to every enemy within Radius of the target point.")]
|
||||
[Min(0f)]
|
||||
|
|
@ -43,5 +58,15 @@ namespace TD.Gameplay.BuilderSpells
|
|||
|
||||
return hitAny;
|
||||
}
|
||||
|
||||
public override void ClientPlayVfx(Vector3 targetPoint)
|
||||
{
|
||||
if (impactVfxPrefab != null)
|
||||
Destroy(Instantiate(impactVfxPrefab, targetPoint, Quaternion.identity), impactVfxLifetime);
|
||||
|
||||
if (impactSound.clip != null)
|
||||
AudioManager.Instance?.Play(impactSound.clip, AudioCategory.TowerFire,
|
||||
impactSound.RandomPitch(), impactSound.volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue