Y
Y
yraiv2022-03-20 19:03:45
Unity
yraiv, 2022-03-20 19:03:45

Why can the rate of fire slow down when there is only 1 enemy left?

When there are a lot of enemies, then the rate of fire does not change, but if the enemy is left alone, does it decrease sharply?

void Fire()
    {

        curTimeout += Time.deltaTime;
        if (curTimeout > fireRate)
        {
            Debug.Log("Fire");
            curTimeout = 0;
            _audioSoruce.PlayOneShot(FireSound);
            Rigidbody2D clone = Instantiate(bullet, gunPoint.position, Quaternion.identity) as Rigidbody2D;
            clone.GetComponent<BulletEnter>().atack = thisAtackTower;
            clone.transform.up = gunPoint.up;
            clone.velocity = clone.transform.up * speed;

        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question