enemies split, but it needs a bit of work

This commit is contained in:
Ian Woods 2026-07-28 21:40:59 -07:00
parent 8714885efa
commit 11ad19992d
10 changed files with 111 additions and 3 deletions

View file

@ -28,7 +28,7 @@ namespace TD.Gameplay.EnemyAbilities
[Tooltip("Relative weight of an enemy rolling no ability at all, vs. the combined " +
"weight of every entry in 'abilities'. Higher = abilities are rarer.")]
[Min(0f)]
[SerializeField] private float noAbilityWeight = 20f;
[SerializeField] private float noAbilityWeight = 100f;
// Fixed-size, enum-indexed lookup built once in Awake. Sized to the enum's entry count,
// not authored count, so an out-of-range Kind is a compile-time impossibility rather

View file

@ -28,12 +28,17 @@ namespace TD.Gameplay.EnemyAbilities
public override void ServerOnDeath(EnemyAbility instance, EnemyHealth health)
{
Debug.Log($"[SplitOnDeathAbility] ServerOnDeath fired for {instance.name}. " +
$"SplitInto={(SplitInto != null ? SplitInto.name : "null")}, " +
$"WaveManager.Instance={(WaveManager.Instance != null)}");
if (SplitInto == null) return;
var movement = instance.GetComponent<EnemyMovement>();
var atTile = GridCoordinates.WorldToGrid(instance.transform.position);
var ownerSlot = movement != null ? movement.OriginZone : PlayerSlot.None;
Debug.Log($"[SplitOnDeathAbility] Spawning {SplitCount}x {SplitInto.name} at tile {atTile}.");
WaveManager.Instance?.ServerSpawnSplitEnemies(SplitInto, SplitCount, atTile, ownerSlot, ScatterRadius);
}
}