Ejemplo n.º 1
0
        public static List<GameObject> Generate(int x, int y)
        {
            visibleDotCounter = 0;

            List<GameObject> list = new List<GameObject>();
            array = new DotGameObject[x,y];

            DotGameObject tmp;
            for (int i = 0; i < x; i++)
                for (int j = 0; j < y; j++)
                {
                    tmp = new DotGameObject(i, j);
                    array[i,j] = tmp;
                    list.Add(tmp);
                }

            return list;
        }
Ejemplo n.º 2
0
        static public List <GameObject> Generate(int x, int y)
        {
            visibleDotCounter = 0;

            List <GameObject> list = new List <GameObject>();

            array = new DotGameObject[x, y];

            DotGameObject tmp;

            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    tmp         = new DotGameObject(i, j);
                    array[i, j] = tmp;
                    list.Add(tmp);
                }
            }

            return(list);
        }
Ejemplo n.º 3
0
        public void LoadContent()
        {
            if (mode == Mode.Demo)
            {
                pacmans.Add(new PacmanGameObject(-1, 0));

                monsters.Add(new MonsterGameObject(-3, 0, MonsterGameObject.MonsterGameObjectColor.Blue));
                monsters.Add(new MonsterGameObject(-4, 0, MonsterGameObject.MonsterGameObjectColor.Pink));
                monsters.Add(new MonsterGameObject(-5, 0, MonsterGameObject.MonsterGameObjectColor.Green));
                monsters.Add(new MonsterGameObject(-6, 0, MonsterGameObject.MonsterGameObjectColor.Red));

                listOfAllGameObjects.Add(pacmans);
                listOfAllGameObjects.Add(monsters);
            }
            else if (mode == Mode.Normal)
            {
                monsters.Add(new MonsterGameObject(MonsterGameObject.MonsterGameObjectColor.Blue));
                monsters.Add(new MonsterGameObject(MonsterGameObject.MonsterGameObjectColor.Green));
                monsters.Add(new MonsterGameObject(MonsterGameObject.MonsterGameObjectColor.Pink));
                monsters.Add(new MonsterGameObject(MonsterGameObject.MonsterGameObjectColor.Red));


                Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

                GameCoordinates topLeftArena     = new GameCoordinates(0, 0);
                GameCoordinates bottomRightArena = new GameCoordinates();

                //TODO:remove magic number
                bottomRightArena.X = viewport.Width / 24 - 2;
                bottomRightArena.Y = viewport.Height / 24 - 2;

                walls = board.Walls;

                //borders
                if (
                    //false
                    true
                    )
                {
                    walls.Add(new HorizontalWallGameObject(topLeftArena.Y, topLeftArena.X, bottomRightArena.X));
                    walls.Add(new HorizontalWallGameObject(bottomRightArena.Y, topLeftArena.X, bottomRightArena.X));

                    walls.Add(new VerticalWallGameObject(topLeftArena.X, topLeftArena.Y, bottomRightArena.Y));
                    walls.Add(new VerticalWallGameObject(bottomRightArena.X, topLeftArena.Y, bottomRightArena.Y));
                }

                dots = DotGameObject.Generate(bottomRightArena.X, bottomRightArena.Y);


                listOfAllGameObjects.Add(dots);

                pills = MagicPillGameObject.Generate();

                listOfAllGameObjects.Add(pills);
                listOfAllGameObjects.Add(walls);
                listOfAllGameObjects.Add(portals);
                listOfAllGameObjects.Add(fruits);

                pacman = new PacmanGameObject();
                pacmans.Add(pacman);
                listOfAllGameObjects.Add(pacmans);
                listOfAllGameObjects.Add(monsters);

                List <GameObject> other = new List <GameObject>();
                other.Add(toolBarGameObject = new ToolBarGameObject());
                listOfAllGameObjects.Add(other);

                /*
                 * List<GameObject> monsterHouses = new List<GameObject>();
                 * monsterHouses.Add(monsterHouse);
                 * listOfAllGameObjects.Add(monsterHouses);
                 */
            }


            collisionManager = CollisionManager.getInstance();
            collisionManager.Initialize(walls, portals, monsterHouses,
                                        dots, pills, fruits,
                                        pacmans, monsters);


            GameObject.LoadStaticContent();

            foreach (List <GameObject> list in listOfAllGameObjects)
            {
                foreach (GameObject gameObject in list)
                {
                    gameObject.LoadContent();
                }
            }
        }