Heroic Engine
  • Welcome
  • Getting Started
    • Quickstart
    • Example Games
      • Tic Tac Toe
      • Turn based duel
  • Basics
    • Injection Manager
    • Engine Systems
      • Core Systems
        • Events Manager
        • Input Manager
        • Localization Manager
          • LangText component
        • Music Player
        • Sounds Manager
        • Time Manager
        • Scenes Loader
        • Day Time Controller
        • Weather Controller
      • Gameplay Systems
        • Currencies Manager
        • Player Progression Manager
        • Quest Manager
        • Random Events Manager
        • Hittables Manager
        • Dungeon Generator
      • UI Systems
        • UI Controller
        • Countdown Controller
    • Editor Tools
      • Clear Saves
      • Mobile Build Optimizer
      • Create System
      • Icon from Prefab Generator
    • Engine Utilities
      • PoolSystem
      • DataSaver
      • ComponentExtensions
      • MaterialExtensions
      • SpriteUtils
      • SlowUpdate
      • StringUtils
      • TypeUtility
      • MathHelper
      • VectorUtils
      • TransformUtils
      • MeshUtils
    • Useful Components
      • Floating Item
      • Fly Up Text
      • Label Scaler
      • Ragdoll
      • Rotate To Camera
      • Orbital Camera
      • Rotator
      • Texture Mover
      • Hittable
      • Projectile
      • Projectile2D
      • LifetimeObject
      • Spawner
      • Colorized Particles
      • Draggable2D
      • SaveableTransform
    • Useful Attributes
Powered by GitBook
On this page
  • Parameters in inspector
  • Available methods
  1. Basics
  2. Engine Systems
  3. UI Systems

Countdown Controller

PreviousUI ControllerNextEditor Tools

Last updated 4 months ago

Presented by ICountdownController interface, this system allows to start countdown with needed time length, invoke certain action each tick and in the end of such countdown. It will also show descending numbers via in the center of screen and play tick sounds if they were assigned.

To use this system, inject ICountdownController interface into your class, as shown below:

[Inject] private ICountdownController countdownController;

Parameters in inspector

countdownSounds – you can assign your custom sounds for countdown ticks (starting from 1st, ending by Nth tick, so 0th element in this list will be the last sound before the end of countdown)

It should be like this:


Available methods

void StartCountdown(float seconds, Action tickCallback, Action endCallback, Action cancelCallback = null)

This method starts cooldown with certain length in seconds, it calls tickCallback every tick, endCallback in the end of countdown and cancelCallback in case if countdown is cancelled.

Example (from DuelPlayerController.cs):

private void StartGame()
{
    countdownController.StartCountdown(3, null, ShowSkills, ShowSkills);
}

void CancelCountdown()

This method cancels current countdown and instantly calls cancel callback if it was assigned beforehand by StartCountdown method.

IUIController
Countdown sounds assignment