user-magnifying-glassHeroes Overview

Heroes are the playable characters in the game. The template includes two heroes by default: Archer and Thief. Heroes can be selected, purchased, and upgraded in the Heroes Tab of the Armory Page within the Main Menu.

Hero Data

Hero Data asset example
  • Hero Name, Hero Icon - Self-explanatory. These values are displayed on the Armory Page UI.

  • Prefab - The hero prefab containing the model, animator, visual effects, and helper components.

  • Is Default Hero - If enabled, this hero will be selected automatically when the player launches the game for the first time.

  • Is Unlocked by Default - If enabled, the hero will be available from the start without requiring a purchase.

  • Hero Levels - A list of upgrade levels that players can purchase to increase stats and unlock starting abilities. Each level contains the following fields:

    • Cost - The amount of gold required to upgrade the hero to this level.

    • Hero Rarity - Common, Rare, Mystic, or Legendary. Each rarity has unique UI visuals and gives players a stronger sense of progression.

    • Stats - The hero’s base attributes (HP, Damage, etc.). These form the foundation of the player’s total stats, combined with bonuses from equipped items. Abilities and upgrades typically apply multipliers to these values.

    • Attached Abilities - The abilities that the hero starts with at the beginning of a stage.

circle-info

Note: Hero Level values do not stack. For example, if Level 1 grants 100 HP and Level 2 grants 120 HP, the hero’s HP will be 120, not 220. Likewise, if a stat or ability exists at Level 1 but not at Level 2, it will be lost upon upgrading.

Hero Prefab Structure

Each hero is represented by a prefab that defines its components, visuals, and gameplay behavior. Here’s an overview of the hero prefab structure:

  • Root GameObject - Contains the HeroBehavior component, which controls the hero’s core logic and interactions.

  • Character Model - The 3D model of the hero, with an Animator and a HeroEventsHandler component.

  • Weapon Parents - Two GameObjects, one for each hand, that act as anchors for weapons. When initialized, the active weapon is placed in one of them.

  • Flying Weapon Holder - A component that manages the weapon when the Flying Weapon ability is active.

  • Status Effects Helper - Defines how the hero responds to various status effects.

  • Renderers Helper - Applies the rim visual effect to the hero’s renderers.

  • Particles - A collection of particles used for healing, walking, and abilities visuals.

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.

Hero Behavior Structure

The HeroBehavior component implements the IHeroBehavior interface. All interactions between the hero and the rest of the project are routed through this interface, allowing you to create custom implementations of HeroBehavior without rewriting references across the project.

All methods in HeroBehavior are virtual and there are no private methods, making it highly extensible and easy to customize.

Hero Behavior Inspector

Most fields of HeroBehavior are references to components within the hero prefab, with a few notable exceptions:

  • Flying Weapon Speed Distance - A speed curve that ensures smooth weapon movement while the Flying Weapon ability is active, keeping the weapon close to the player in all gameplay situations.

  • Get Hit Sound, Heal Sound, Step Sound - References to Audio Data assets containing the respective sound effects.

Hero Animations

To support a wide variety of weapon types, the template provides a flexible animation set system. By default, all animations in the hero’s Animator are empty placeholders:

At runtime, the game replaces these placeholders with animations from an animation set asset specific to each hero-weapon combination.

You can assign these animation sets in the Armory Database asset.

Hero Animator

The animator has the following structure:

  1. Movement With Weapon - A blend tree that handles Idle, Walk, and Run animations while the hero is holding a weapon.

  2. Movement Without Weapon - A blend tree for Idle, Walk, and Run animations when the hero is unarmed.

  3. Shoot - The animation of the hero firing a weapon. It transitions back to movement when the animation finishes or when the player starts moving. Only plays if the Flying Weapon ability is not active.

  4. Defeat - The hero’s death animation.

  5. Revive - The animation played when the hero revives.

Hero Events Handler

The HeroBehavior component responds to several animation events:

  • Shoot (from the Shoot animation) - Spawns a projectile.

  • OnDefeatAnimationEnded (from the Defeat animation) - Notifies the hero that the defeat animation has finished.

  • OnReviveAnimationEnded (from the Revive animation) - Notifies the hero that the revive animation has finished.

  • Step (from the Walk and Run animations) - Triggers step-related visual and audio effects.

Last updated