private void LevelSelectScreen_ReplaySelected(object sender, CachedLevelData cld, string replayId) { var level = new SoundodgerLevel(cld.XmlPath); LoadReplayAndStart(level, replayId, cld.Settings); }
private void RestartCurrentLevel() { audioPlayer.Stop(); var level = new SoundodgerLevel(Arena.Level.XmlPath); SwitchToArenaAndStart(level, Arena.ActiveMod, Arena.LevelSettings); }
public void SwitchToArenaAndStart(SoundodgerLevel level, Mod mods, LevelSettings settings) { logger.Info("Level selected: {artist} - {title} by {designer} ({hash})", level.Info.Artist, level.Info.Title, level.Info.Designer, level.XmlHash); Arena = new Arena(inputHelper); InitArena(Arena); Desktop.Root.Visible = false; IsMouseVisible = false; SetVsync(Config.GameSettings.Vsync); try { Arena.LoadLevelAndStart(level, mods, settings); gameState = GameState.PlayingLevel; } catch (Exception ex) { logger.Error(ex, "Level failed to load"); #if DEBUG throw; #else SwitchToLevelSelectScreen(); ShowErrorMessage("The level failed to load.\nCheck the game log for details."); #endif } }
protected override Spawner ConstructSpawner(SoundodgerLevel level) { return(new LiveSpawner() { Arena = arena, BorderColor = level.Info.Colors.Outline, }); }
public ShotCreator(Vector2 arenaCenter, float arenaRadius, SoundodgerLevel level, List <StreamShot> activeStreams, CircleParticleSystem particles) { this.arenaRadius = arenaRadius; this.arenaCenter = arenaCenter; Level = level; this.activeStreams = activeStreams; this.particles = particles; }
public void CreateIndicatorList(SoundodgerLevel level) { foreach (var shot in level.Script.Shots) { foreach (var enemyIdx in shot.Enemies) { Util.GetSpawnerFromShotIndex(Spawners, enemyIdx) .AddToIndicatorList( shot.Time, shot.Color); } } }
protected virtual void ConstructSpawners(SoundodgerLevel level) { var amount = level.Info.Enemies; var ceil = (int)Math.Ceiling(amount); Spawners = new List <Spawner>(ceil); for (int i = 0; i < ceil; i++) { Spawner spawnerCircle = ConstructSpawner(level); SetLastShot(level, i, spawnerCircle); Spawners.Add(spawnerCircle); } }
public BulletManager(ArenaCircle arena, SoundodgerLevel level, List <Spawner> spawners, Mod activeMods, CircleParticleSystem particles) { this.arena = arena; shotCreator = new ShotCreator(arena.Circle.Center, arena.Circle.Radius, level, ActiveStreams, particles); Shots = new List <Shot>(level.Script.Shots); this.spawners = spawners; this.activeMod = activeMods; this.particles = particles; this.level = level; bulletDrawer = new BulletDrawer(Bullets); shotIterator = new TimeIter <Shot>(Shots, x => x.Time, OnFireShot); }
protected void SetLastShot(SoundodgerLevel level, int i, Spawner spawner) { var lastShot = level.Script.Shots.LastOrDefault( x => x.Enemies.Contains(i)); if (lastShot is null) { spawner.DespawnPoint = 0f; } else { spawner.DespawnPoint = (float)lastShot.Time; if (lastShot is StreamShot ss) { spawner.DespawnPoint += (float)ss.Duration; } } }
protected virtual Spawner ConstructSpawner(SoundodgerLevel level) { Spawner spawner; if (useCenterSpawnerGlitch) { spawner = new CenterGlitchSpawner(); } else { spawner = new Spawner(); } spawner.Arena = arena; spawner.BorderColor = level.Info.Colors.Outline; spawner.Center = Vector2.Zero; return(spawner); }
public void LoadReplayAndStart(SoundodgerLevel level, string replayId, LevelSettings settings) { logger.Info("Replay selected: {replayId} for {artist} - {title} by {designer} ({hash})", replayId, level.Info.Artist, level.Info.Title, level.Info.Designer, level.XmlHash); Arena = new ReplayArena(inputHelper); InitArena(Arena); Desktop.Root.Visible = false; IsMouseVisible = false; SetVsync(Config.GameSettings.Vsync); try { var replay = Replay.Open(Path.Combine(Replay.ReplaysDir, replayId)); (Arena as ReplayArena).LoadReplayAndStart(level, replay, settings); gameState = GameState.PlayingLevel; } catch (Exception ex) { logger.Error(ex, "Replay failed to load"); SwitchToLevelSelectScreen(); ShowErrorMessage("The replay failed to load.\nCheck the game log for details."); } }
public void CreateSpawners(SoundodgerLevel level) { useCenterSpawnerGlitch = level.UsesCenterSpawnerGlitch; ConstructSpawners(level); SetSpawnerAngles(level.Info.Enemies); }
private void LevelSelectScreen_LevelSelected(object sender, CachedLevelData cld, Mod mods) { var level = new SoundodgerLevel(cld.XmlPath); SwitchToArenaAndStart(level, mods, cld.Settings); }