Système de vagues d'ennemis

VérifiéSûr

Système de vagues pour jeux de Tower Defense et Survival. Configure les vagues, types d'ennemis, intervalles et difficulté via ScriptableObjects. Utilisé pour des assauts ennemis chronométrés, mode Horde ou vagues de boss.

Spar Skills Guide Bot
DeveloppementIntermédiaire
7002/06/2026
Claude Code
#spawner#horde#waves#enemies#tower-defense

Recommandé pour

Notre avis

Système de vagues d'ennemis pour jeux Tower Defense et survival, configurable via ScriptableObjects.

Points forts

  • Utilisation de ScriptableObjects pour une configuration facile sans code
  • Architecture claire séparant contrôleur, config et spawner
  • Support de l'object pooling pour les performances
  • Vagues personnalisables avec taux d'apparition et types d'ennemis

Limites

  • Nécessite l'implémentation d'un système d'object pooling séparé
  • Ne gère pas le comportement des ennemis après le spawn
  • Pas de gestion intégrée de la difficulté progressive (scaling)
Quand l'utiliser

Utilisez ce pattern pour tout jeu nécessitant des vagues d'ennemis scriptées temporisées (Tower Defense, Horde Mode).

Quand l'éviter

Évitez-le si votre jeu ne nécessite pas de vagues structurées ou si vous utilisez un système de spawn événementiel non temporel.

Analyse de sécurité

Sûr
Score qualité92/100

The skill provides game development design patterns with C# code examples. It does not instruct any destructive, exfiltrating, or unsafe operations. The allowed tools (run_command, list_dir, write_to_file) are typical for a coding agent and are not misused in this context.

Aucun point d'attention détecté

Exemples

Wave Config Data
Create data for a wave. Use a ScriptableObject with fields for enemy prefab, count, and spawn rate.
Spawner Logic
Write a coroutine that spawns a wave of enemies with a configurable delay between each spawn.

name: horde-wave-logic description: "Wave spawning system for Tower Defense and Survival games. Configurable waves, enemy types, intervals, and difficulty scaling." version: 1.0.0 tags: ["spawner", "horde", "waves", "enemies", "tower-defense"] argument-hint: "action='StartWave' config='Wave1' OR spawn='Zombie_Fast'" disable-model-invocation: false user-invocable: true allowed-tools:

  • run_command
  • list_dir
  • write_to_file

Horde & Wave Logic

Overview

Manages the pacing and spawning of enemy units. Uses ScriptableObjects to define wave configurations, allowing designers to tweak difficulty without touching code.

When to Use

  • Use for Tower Defense games
  • Use for "Horde Mode" survival
  • Use for timed enemy assaults
  • Use for testing combat balance
  • Use for creating "Boss Waves"

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    WAVE CONTROLLER                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  WAVE CONFIG (Asset)      SPAWNER (MonoBehaviour)           │
│  ┌────────────────┐      ┌───────────────────────────┐      │
│  │ Wave 1:        │      │ State: Waiting/Spawning   │      │
│  │ - 10 Zombies   │─────▶│ Timer: 30s                │      │
│  │ - Rate: 0.5s   │      │ Coroutine: SpawnLoop()    │      │
│  └────────────────┘      └─────────────┬─────────────┘      │
│                                        │                    │
│                                        ▼                    │
│    OBJECT POOL            ┌───────────────────────────┐     │
│  ┌────────────────┐       │ Instantiate / GetFromPool │     │
│  │ Zombie Prefab  │◀──────│ Set Position (SpawnPoint) │     │
│  └────────────────┘       └───────────────────────────┘     │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Best Practices

  • ✅ Use Object Pooling for enemies (Critical for performance).
  • ✅ Define Waves as ScriptableObjects (List of Waves).
  • ✅ Include "Warmup" time between waves.
  • ✅ Support multiple Spawn Points.
  • ✅ Implement "Wave Cleared" logic (Track active enemy count).
  • NEVER Instantiate enemies during the loop without pooling.
  • NEVER use InvokeRepeating (hard to control); use Coroutines.

Few-Shot Examples

Example 1: Wave Config Data

User: "Create data for a wave."

Agent:

[CreateAssetMenu]
public class WaveData : ScriptableObject
{
    public GameObject EnemyPrefab;
    public int Count;
    public float SpawnRate;
}

Example 2: Spawner Logic

User: "Spawn the wave."

Agent:

IEnumerator SpawnWave(WaveData wave)
{
    for (int i = 0; i < wave.Count; i++)
    {
        SpawnEnemy(wave.EnemyPrefab);
        yield return new WaitForSeconds(wave.SpawnRate);
    }
}

Related Skills

  • @object-pooling-system - Required for spawner
  • @unit-population-ai - AI for spawned units
  • @unity-events-messaging - "Wave Start/End" events
Skills similaires