예제 #1
0
    void Update()
    {
        if (dashing)
        {
            enemy.SetSpeed(dashSpeed);
        }

        dashTimer += Time.deltaTime;
        if (inDashRange && dashTimer >= dashCooldown)
        {
            attack();
            dashTimer = 0;
        }
    }
예제 #2
0
    void Update()
    {
        if (enemy.inAction || this.WithinStopDistance())
        {
            enemy.SetSpeed(0);
        }
        else
        {
            flipTimer += Time.deltaTime;
            if (flipTimer >= flipCooldown)
            {
                enemy.LookAtTarget();
                flipTimer = 0;
            }

            enemy.SetSpeed(speed);
        }
    }