public override void Initialize() { MyGame game = this.Game as MyGame; this.Maze = MazeBuilder.GetDefaultFor(game.Content); this.PrepareMazeUI(); Puckman p = new Puckman(game); p.CurrentLocation = this.Maze.GetStartSection(); p.Initialize(); KeyboardController keyboard = new KeyboardController(game, p); keyboard.Initialize(); this.Components.Add(p); this.Components.Add(keyboard); ///* //Ghost 1 RegisterNewGhost(@"Sprites\blinky.png", p, this.Maze[1, 4], this.Maze[5, 4]); //Ghost 2 RegisterNewGhost(@"Sprites\pinky.png", p, this.Maze[26, 22], this.Maze[29, 22]); //Ghost 3 RegisterNewGhost(@"Sprites\inky.png", p, this.Maze[26, 6], this.Maze[29, 6]); //Ghost 2 RegisterNewGhost(@"Sprites\clyde.png", p, this.Maze[1, 24], this.Maze[5, 24]); //*/ base.Initialize(); }
private void RegisterNewGhost(String ghostType, Puckman p, MazeSection r1, MazeSection r2) { Ghost g1 = new Ghost(this.Game as MyGame, ghostType); g1.Region = Tuple.Create(r1, r2); g1.CurrentLocation = this.Maze.GetGhostLairSection(); g1.Initialize(); this.Components.Add(g1); GhostAIController iaCtrl1 = new GhostAIController(this.Game as MyGame, g1, p); iaCtrl1.Initialize(); this.Components.Add(iaCtrl1); }