public Game(GameWorld main, GameWorld shadow, TextModule textModule, double worldWidth, double worldHeight) { this.textModule = textModule; Width = Height = 800; WorldHeight = worldHeight; WorldWidth = worldWidth; status = GameStatus.ShowLevelText; mainWorld = main; shadowWorld = shadow; mainWorld.game = shadowWorld.game = this; mainWorld.anotherWorld = shadowWorld; shadowWorld.anotherWorld = mainWorld; }
public void OnTick(double dt) { if (textModule.Empty() && status == GameStatus.ShowLevelText) { status = GameStatus.Running; } if (textModule.Empty() && status == GameStatus.ShowEndText) { status = GameStatus.GameEnd; } if (mainWorld.Shapes.Any(p => p is PlayerBrother) && mainWorld.world.IsBodyOnGround(mainWorld.player, new Point(0, 1)) && status == GameStatus.Running) { textModule = new TextModule( new[] { "- Братья! Я так долго искал вас!", "- Не шуми. Мы тоже рады тебе. Но нам стоит поторопиться...", "Следуй за нами...", "MAY BE TO BE CONTINUED..." }); status = GameStatus.ShowEndText; } if (status == GameStatus.GameOver || status == GameStatus.ShowLevelText || status == GameStatus.GameEnd || status == GameStatus.ShowEndText) { return; } shadowWorld.OnTick(dt); mainWorld.OnTick(dt); CenterThePlayer(); CheckPlayer(); }