public void RestBullet(BaseBullet bullet, bool hitPlayer, bool showPoof) { bullet.GetComponent <SpriteRenderer>().sprite = null; _activeBullets.Remove(bullet); bullet.Poof(); if (hitPlayer) { _hits++; } }
void Awake() { QualitySettings.vSyncCount = 0; Application.targetFrameRate = 60; _bulletCache = new Queue <BaseBullet>(); for (int i = 0; i < 5000; i++) { BaseBullet bullet = Instantiate(_baseBullet, transform).GetComponent <BaseBullet>(); bullet.Create(); bullet.GetComponent <SpriteRenderer>().sortingOrder = i; _bulletCache.Enqueue(bullet); } }