예제 #1
0
        private void GainOneLife()
        {
            _canExecuteHealingAbility = false;
            _currentLives++;
            _livesUI.SetLives(_currentLives);

            // Show the cooldown UI
            _cooldownUI.Show();

            _healingAbilityCooldownTask?.Kill();

            // Reenable the healing ability after the cooldown
            _healingAbilityCooldownTask = STasks.Do(() => _canExecuteHealingAbility = true, _healingCooldown);

            // Update the cooldown UI every frame
            _healingAbilityCooldownTask.OnUpdate(() => _cooldownUI.SetProgress(_healingAbilityCooldownTask.Progress));

            // Hide the cooldown UI when the task is complete
            _healingAbilityCooldownTask.OnComplete(() => _cooldownUI.Hide());
        }
예제 #2
0
 private void PrintHelloWorldAfterThreeSeconds()
 {
     // Print "hello world" after three seconds
     STasks.Do(() => Debug.Log("Hello world!"), after: 3.0f);
 }