private void Update() { Vector3 rail_position = turret.forward; Vector3 bullet_direction = turret.up; if (DebrisNoirsInput.firing() && satellite.alive()) // if firing and not dead { PlanetariaGameObject.Instantiate(projectile, rail_position, bullet_direction); } }
private void Update() { Vector3 rail_position = turret.forward; Vector3 bullet_direction = turret.up; if (DebrisNoirsInput.firing() && satellite.alive()) // if firing and not dead { if (projectiles_on_screen.Count < 14) // FIXME: MAGIC NUMBER - number of bullets spawned per second { PlanetariaGameObject spawned_projectile = PlanetariaGameObject.Instantiate(projectile, rail_position, bullet_direction); projectiles_on_screen.Add(spawned_projectile.internal_game_object.GetComponent <Projectile>()); } else { projectiles_on_screen[next_projectile_to_reuse].respawn(rail_position, bullet_direction); next_projectile_to_reuse += 1; if (next_projectile_to_reuse >= 14) { next_projectile_to_reuse -= 14; } } } }