Пример #1
0
        public void startLevel(int level)
        {
            int xPos = 20;
            int yPos = 20;

            CombatBoard  board  = this.combatScreen.MyCombatBoard;
            List <Human> humans = board.getHumans();

            foreach (Human human in humans)
            {
                CombatHUDPanel humanPanel = new CombatHUDPanel(lhg, human);
                humanPanel.Position = new Vector2(xPos, yPos);
                yPos += 75;
                humanPanels.Add(humanPanel);
            }

            xPos = 200;
            yPos = 20;

            List <Zombie> zombies = board.getZombies();

            foreach (Zombie zombie in zombies)
            {
                CombatHUDPanel zombiePanel = new CombatHUDPanel(lhg, zombie);
                zombiePanel.Position = new Vector2(xPos, yPos);
                zombiePanels.Add(zombiePanel);
            }
        }
Пример #2
0
        private GameEntities loadGameEntities(XmlNode gameEntitiesNode, CombatBoard board)
        {
            GameEntities gameEntities = new GameEntities();

            XmlNodeList childNodes = gameEntitiesNode.ChildNodes;

            foreach (XmlNode childNode in childNodes)
            {
                switch (childNode.Name)
                {
                case "heroes":
                    break;

                case "enemies":
                    progress.updateProgress("Loading Enemies", "Loading Enemies", 40);
                    loadEnemies(childNode, gameEntities, board);
                    break;

                case "obstacles":
                    progress.updateProgress("Loading Obstacles", "Loading Obstacles", 50);
                    loadObstacles(childNode, gameEntities, board);
                    break;
                }
            }

            return(gameEntities);
        }
Пример #3
0
        public CombatScreen screen;  // The Combat screen that is holding our board

        public CombatLocation(CombatBoard board, int i, int j)
        {
            this.board  = board;
            this.i      = i;
            this.j      = j;
            this.screen = board.MyCombatScreen;
        }
Пример #4
0
        private void loadObstacles(XmlNode obstaclesNode, GameEntities gameEntities, CombatBoard board)
        {
            XmlNodeList children = obstaclesNode.ChildNodes;

            foreach (XmlNode childNode in children)
            {
                Obstacle obstacle = obstacleFactory.createObstacleForCombat(board, childNode);
                if (obstacle != null)
                {
                    gameEntities.addObstacle(obstacle);
                }
            }
        }
Пример #5
0
        private void loadEnemies(XmlNode enemiesNode, GameEntities gameEntities, CombatBoard board)
        {
            XmlNodeList playerNodes = enemiesNode.ChildNodes;

            foreach (XmlNode playerNode in playerNodes)
            {
                if (playerNode.Name.Equals("player"))
                {
                    Player player = playerFactory.createPlayerForCombat(board, playerNode);
                    if (player != null)
                    {
                        gameEntities.addPlayer(player);
                    }
                }
            }
        }
Пример #6
0
        private CombatBoard loadBoard(XmlNode boardNode)
        {
            CombatBoard board = null;

            if (boardNode != null)
            {
                XmlNodeList boardChildren = boardNode.ChildNodes;
                foreach (XmlNode childNode in boardChildren)
                {
                    switch (childNode.Name)
                    {
                    case "dimensions":
                        int   size = 0, height = 0, width = 0, xoffset = 0, yoffset = 0, penWidth = 0;
                        bool  isPointy   = false;
                        Color boardColor = Color.White;

                        loadDimensions(childNode, ref size, ref height, ref width, ref xoffset, ref yoffset, ref penWidth, ref isPointy, ref boardColor);
                        board = new CombatBoard(this.lhg, size, width, height, xoffset, yoffset, penWidth, isPointy, boardColor);
                        break;

                    case "colors":
                        if (board != null)
                        {
                            Color backgroundColor = Color.Black, selectedPlayerColor = Color.Black, moveRadiusColor = Color.Black,
                                  moveSelectColor = Color.Black, attackRadiusColor = Color.Black;

                            loadColors(childNode, ref backgroundColor, ref selectedPlayerColor, ref moveRadiusColor, ref moveSelectColor, ref attackRadiusColor);
                            board.setHexColors(backgroundColor, selectedPlayerColor, moveRadiusColor, moveSelectColor, attackRadiusColor);
                        }
                        break;

                    case "gameEntities":
                        if (board != null)
                        {
                            GameEntities gameEntities = loadGameEntities(childNode, board);
                            board.MyGameEntities = gameEntities;
                        }
                        break;
                    }
                }
            }

            return(board);
        }
Пример #7
0
 public CombatLocation(CombatBoard board, int i, int j, AnimationKey direction, Vector3 position)
     : this(board, i, j, direction)
 {
     this.position = position;
 }
Пример #8
0
 public CombatLocation(CombatBoard board, int i, int j, AnimationKey direction)
     : this(board, i, j)
 {
     this.direction = direction;
 }