示例#1
0
 public void init(Maze m, Ghosts g, Pacman p)
 {
     _dots_colision_controler = new DotsColisionControler(m);
     _super_dots_colision_controler = new SuperDotsColisionControler(m);
     _ghosts_colision_controler = new GhostsColisionControler(g , p);
     _fruit_colision_controler = new FruitColisionControler(p, m);
 }
示例#2
0
        public void init()
        {
            // Create maze
            maze = new Maze(elements.gridDots);

            // Create player1
            pacman = new Pacman(elements.gridPacman, maze);

            // Create ghosts
            GhostRed blinky = new GhostRed(elements.gridPacman, maze, pacman);
            GhostPink pinky = new GhostPink(elements.gridPacman, maze, pacman);
            GhostBlue inky = new GhostBlue(elements.gridPacman, maze, pacman, blinky);
            GhostYellow clyde = new GhostYellow(elements.gridPacman, maze, pacman);
            ghosts = new Ghosts();
            ghosts.add(blinky, pinky, inky, clyde);

            // Setup Ghost Mode Controler
            GhostModeControler.Instance.init(ghosts, elements.gridPacman);

            // Create colision controler
            ColisionControler.Instance.init(maze, ghosts, pacman);
            pacman.addObserver(ColisionControler.Instance);
            ghosts.addObserver(ColisionControler.Instance);

            // Create game controler
            GameControler.Instance.init(elements, ghosts, pacman, maze);
            ColisionControler.Instance.addObserver(GameControler.Instance);

            pacman.addObserver(GameControler.Instance);

            
            SoundEffect.Instance.addObserver(GameControler.Instance);
        }
示例#3
0
        public void init(WPFElements e, Ghosts g, Pacman p, Maze m)
        {
            _level = 1;
            _score = 0;
            _pacman_lifes = 0;
            _points_for_extra_life = 500;

            _labelScore = e.labelScore;
            _labelSubmitScore = e.labelSubmitScore;
            _labelGetReady = e.labelGetReady;
            _labelHighscore = e.labelHighscore;

            _ghosts = g;
            pacman = p;
            _maze = m;

            _grid_pacman = e.gridPacman;
            _grid_highscore = e.gridHighscore;
            _grid_pacman_lifes = e.gridPacmanLifes;
            _grid_fruits = e.gridFruits;

            // Create pacman's life images
            _lifes_images = new List<Image>();
            for (int i = 0; i < _pacman_lifes; i++ )
            {
                addLifeImg(i);
            }
            _fruits_images = new List<Image>();

            // Fruit img
            addFruitImg();

            setup();

            _highscore = Int32.Parse(DataBase.Instance.getHighScore());
            _labelHighscore.Content = String.Format("{0:n0}", _highscore);
        }
 public GhostsColisionControler(Ghosts g, Pacman p)
 {
     _observer_list = new List<IObserver>();
     _ghosts = g;
     _pacman = p;
 }