// After delay seconds: Kill all enemies and convert all enemy bullets to score pickups, then collect them private IEnumerator BombEffect(float delay) { yield return(new WaitForSeconds(delay)); StageHandler.KillAllEnemies(); BulletHandler.BulletsToScore(); StageHandler.CollectAllPickups(useConstantScore: true); }
void FixedUpdate() { // Move if not paralyzed if (paralyzed) { rb.velocity = Vector2.zero; } else { rb.velocity = movement * Time.fixedDeltaTime; } // Clamp position to screen transform.position = new Vector3( Mathf.Clamp(transform.position.x, movementRangeMin.x, movementRangeMax.x), Mathf.Clamp(transform.position.y, movementRangeMin.y, movementRangeMax.y) ); // Loop instead of if, for firerates higher than the framerate while (shooting && Time.time > nextFire) { // Update velocity and position bulletData.velocity = shotSpeed; bulletData.pos = transform.position + Vector3.up * 0.3f; HandleShot(bulletData, power); nextFire += 1 / firerate; // TODO: Change to firedelay } // Collect all pickups if above collection line if (transform.position.y > collectionLineY) { StageHandler.CollectAllPickups(); } }