Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (!disabled)
        {
            if (attackCooldownTimer <= 0)
            {
                if (!controller.IsAttackBlocked() && AttackCondition())
                {
                    Attack();
                    OnAttackStart();
                }
            }
            else
            {
                attackCooldownTimer -= Time.deltaTime;
            }

            if (attackDurationTimer > 0)
            {
                WhileAttacking();
                attackDurationTimer -= Time.deltaTime;
                if (attackDurationTimer <= 0)
                {
                    OnAttackEnd();
                }
            }
        }
    }