54 lines
2.2 KiB
C#
54 lines
2.2 KiB
C#
// Assets/_Project/Scripts/Gameplay/WaveDefinition.cs
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace TD.Gameplay
|
|
{
|
|
/// <summary>
|
|
/// A single spawn group within a wave: one enemy type, how many of them,
|
|
/// and how long to wait between each spawn.
|
|
/// </summary>
|
|
[Serializable]
|
|
public struct WaveEntry
|
|
{
|
|
[Tooltip("The enemy type to spawn for this group.")]
|
|
public EnemyDefinition EnemyType;
|
|
|
|
[Tooltip("How many enemies of this type to spawn.")]
|
|
public int Count;
|
|
|
|
[Tooltip("How many enemies spawn per burst. 1 (default) = original one-at-a-time " +
|
|
"behaviour. Values > 1 spawn that many simultaneously before waiting SpawnInterval.")]
|
|
public int ChunkSize;
|
|
|
|
[Tooltip("Seconds between each burst. With ChunkSize > 1 this is the pause between " +
|
|
"groups rather than between individual enemies.")]
|
|
public float SpawnInterval;
|
|
|
|
[Tooltip("Max X-axis world-unit offset applied randomly to each enemy's spawn position. " +
|
|
"0 = all spawn at the exact tile centre. Spreads enemies left/right without " +
|
|
"affecting their forward/backward position or A* pathfinding.")]
|
|
public float SpawnSpread;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Defines the composition of a single wave. One asset per wave; referenced in
|
|
/// order by <see cref="WaveManager.waveDefinitions"/>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Entries are processed in array order. Multiple entries let designers mix enemy
|
|
/// types within one wave (e.g. 10 fast scouts followed by 3 armoured brutes).
|
|
/// The wave is not considered complete until all spawned enemies are dead or have
|
|
/// leaked — not just until all entries are spawned.
|
|
/// </remarks>
|
|
[CreateAssetMenu(fileName = "WaveDefinition", menuName = "TD/Wave Definition", order = 4)]
|
|
public class WaveDefinition : ScriptableObject
|
|
{
|
|
[Tooltip("Seconds between the wave-number advancing (start of prep) and the " +
|
|
"first enemy spawning. Gives players time to build before the wave hits.")]
|
|
public float PrepTime = 10f;
|
|
|
|
[Tooltip("Enemy groups that make up this wave. Processed in order.")]
|
|
public WaveEntry[] Entries;
|
|
}
|
|
}
|