alien-8bitEnemies Overview

Included Enemies

The template features 14 unique enemies and 6 unique bosses, each with their own combat style and behavior patterns.

Enemies

  • Cauldron - Fires arched projectiles that leave damaging puddles on the ground.

  • Jelly - Shoots projectiles in all directions

  • Plant - Shoots projectiles, remains stationary but teleports to new positions instead of moving.

  • Wasp - Charges toward the player.

  • Eye - Shoots lasers from it's eye.

  • Slime - Splits into smaller slimes upon defeat.

  • Bomb - Chases the player and explodes on contact.

  • Pumpkin - Shoots bursts of seed projectiles.

  • Bat - Fires small projectiles from range.

  • Hand - Rushes straight toward the player.

  • Mole - Follows the player underground.

  • Spike - Charges toward the player with noticeable inertia.

  • Trap - Follows the player persistently.

  • Candle - Fires flame projectiles from a distance.

Bosses

  • Queen Wasp - Charges the player, fires honey projectiles, and spawns sticky honey mines.

  • Mighty Cactus - Spawns mini cacti, fires needle barrages in all directions, and uses a rapid-fire minigun attack.

  • Cursed Totem - Fires lasers in multiple directions, summons tornadoes, and calls down giant fists that slam the ground.

  • Ice Slime - Spawns ice spheres, shoots icicles, and creates freezing mines and puddles.

  • Mysterious Mask - Fires dark projectiles and waves, and summons spectral hands that charge at the player.

  • Ancient Golem - Charges the player and performs a variety of lightning-based attacks.

All enemy behavior scripts inherit from the EnemyBehavior base class. This class manages most common functionality, such as:

  • Spawning and death handling

  • Taking damage

  • Reacting to global events and effects

Bosses use the same base logic but feature more complex, multi-phase behaviors and attacks.

Enemy Data Structure

Enemy Data

Each enemy’s data is defined in the Enemy Data asset, which includes the following fields:

  • Name - Used for the boss health bar display.

  • Prefab - The prefab reference for the enemy.

  • Enemy Type - The unique type identifier of the enemy.

  • Is Boss - When enabled, waves containing this enemy display the boss health bar.

  • Drops - A list of items the enemy can drop upon defeat.

Enemy Prefab Structure

Example: Candle Enemy

  • Root GameObject

    • Contains the CandleEnemyBehavior component (core logic and interactions)

    • Includes Rigidbody, Collider, and NavMesh Agent components

  • Enemy Model

    • The 3D model of the enemy

    • Includes an Animator and a component derived from EnemyEventsHandler

  • Healthbar

    • Displays the enemy’s current HP

  • Helpers

    • Player Detector – Detects player proximity for engagement

    • Status Effects Helper – Defines how the enemy reacts to status effects

    • Renderers Helper – Applies rim visual effects to the enemy’s renderers

    • Navigation Helper – Handles enemy movement and navigation

  • Projectile Spawn Point – Defines the location where projectiles are instantiated

circle-info

The Rim effect is only visible if the materials use October.shader or a shader that implements the rim effect in the same way.

Enemy Behavior

Each enemy behavior must override the coroutine:

This coroutine starts when the enemy is spawned and continues to run until it is defeated. It defines the enemy’s attack patterns, movement loops, and decision-making logic.

The Candle enemy’s BehaviorCoroutine:

Bosses typically use more elaborate coroutines, often chaining multiple attacks or summoning phases. The Cursed Totem bos’s BehaviorCoroutine:

Each attack:

  • Triggers different attack animations,

  • Waits for animation events to spawn projectiles or effects,

  • Repeats each attack sequence 2–3 times,

  • Then returns control back to the main BehaviorCoroutine() loop.

Last updated