Ejemplo n.º 1
0
    private void Idle()
    {
        enemy.Stop();

        idleTimer += Time.deltaTime;

        if (idleTimer >= idleDuration)
        {
            enemy.ChangeState(new PatrolStateDemon());
        }
    }
Ejemplo n.º 2
0
    private void DemonMeleeAttack()
    {
        enemy.Stop();

        if (canAttack)
        {
            enemy.enemyAnimator.SetTrigger("demonattack");
            attackTimer = 0f;
            canAttack   = false;
            enemy.ChangeState(new IdleStateDemon());
        }
        else
        {
            attackTimer += Time.deltaTime;
            if (attackTimer >= attackCoolDown)
            {
                canAttack = true;
            }
            else
            {
                enemy.ChangeState(new IdleStateDemon());
            }
        }
    }