private void LoadLevel(int level) { var resource = GD.Load <PackedScene>(LevelFactory.GetLevel(level)); Level = resource.Instance() as Level; Level.Scale = LevelScale; Level.Position = LevePosition; LevelContainer.AddChild(Level); Level.Connect("GameOver", this, nameof(GameOver)); Level.Connect("SwitchLevel", this, nameof(SwitchLevel)); }
static void Main(string[] args) { Map map = Map.GetMap; GameLevel gameLevel = LevelFactory.GetLevel("Easy", map); Player player = Player.GetPlayer; Context context = new Context(); Game game = new Game(player, context, gameLevel); game.DisplayBoard(); game.Start(); Console.WriteLine("Game Over"); Console.WriteLine("Done"); Console.ReadLine(); }
void StartLevel(bool generate) { Debug.Log("Starting Level"); ResetLevelCtxt(); // First reset the context around the current level if (generate) { LevelParams lp = ComputeParams(lvl); currentLevel = levelFactory.GetLevel(lp); currentQuestion = currentLevel.questions[0]; } SpawnLevel(currentLevel); FreezePlayer(true); FreezeEnemiesShoot(true); StartCoroutine(StartAndWaitCountdown(2, 0)); uiMathTable.SetQuestion(currentQuestion); uiLevelCounter.text = lvl.ToString(); currentStats.maxlvl = lvl; }
public Game(Board board, int difficulty) { this.moveFlag = true; this.board = board; this.elements = new List <Drawable>(); this.player = new Player(8, 19, this.obstacles); LevelFactory factory = new LevelFactory(this.board, this.player); Level lvl = factory.GetLevel(difficulty); this.obstacles = lvl.GetObstacles(); this.enemies = lvl.GetEnemies(); this.attackers = lvl.GetAttackers(); this.elements.AddRange(this.enemies); this.elements.AddRange(this.obstacles); this.elements.Add(this.player); this.player.SetObstacles(this.obstacles); this.scoreIndicator = new ScoreIndicator(10, 0, this.player); this.healthIndicator = new HealthIndicator(30, 0, this.player); }