Exemple #1
0
    void Update()
    {
        if (!canAttack)
        {
            if (prepareAttackTimer > 0.0f)
            {
                prepareAttackTimer -= Time.deltaTime;
                if (prepareAttackTimer <= 0.0f)
                {
                    ExecuteAttack();
                    cooldownTimer = attackCooldown;
                    movementInput.EnableInput();
                }
            }

            if (cooldownTimer > 0.0f)
            {
                cooldownTimer -= Time.deltaTime;
                if (cooldownTimer <= 0.0f)
                {
                    canAttack = true;
                }
            }
        }
    }
 void Update()
 {
     if (stunTimer > 0.0f)
     {
         stunTimer -= Time.deltaTime;
         if (stunTimer <= 0.0f)
         {
             movementInput.EnableInput();
             stunTimer = 0.0f;
         }
     }
 }