示例#1
0
        public static void InitalizeWorld(int numRows, int numCols)
        {
            grid = new Tile[numRows, numCols];
            for (int row = 0; row < numRows; row++) {
                for (int col = 0; col < numCols; col++) {
                    grid[row, col] = new Tile(row, col, Tile.TileType.Grass);
                }
            }

            personSet = new HashSet<Person>();
            buildingSet = new HashSet<Building>();
            treeSet = new HashSet<Tree>();
            itemSet = new HashSet<Item>();
            locationsWithAirports = new HashSet<Point>();
            inventory = new Dictionary<ShopItem, int>();

            highlightedTiles = new HashSet<Tile>();

            isNight = false;
            timeLeft = DAY_TIME_LIMIT;
            dayCount = 0;
            money = 0;

            XmlSerializer serializer = new XmlSerializer(typeof(Mission));
            FileStream fs = new FileStream("test.xml", FileMode.Open);
            currentMission = (Mission) serializer.Deserialize(fs);
        }
示例#2
0
 public static void AddHighlight(IEnumerable<Point> points, Tile.TileHighlightColor highlightColor)
 {
     foreach (Point p in points) {
         if (InBound(p)) {
             AddHighlight(p.X, p.Y, highlightColor);
         }
     }
 }
示例#3
0
 public static void AddHighlight(Point p, Dimension d, Tile.TileHighlightColor highlightColor)
 {
     for (int i = p.X; i < p.X + d.Width; i++) {
         for (int j = p.Y; j < p.Y + d.Height; j++) {
             if (InBound(i, j)) {
                 AddHighlight(i, j, highlightColor);
             }
         }
     }
 }
示例#4
0
 public static void AddHighlight(int x, int y, Tile.TileHighlightColor highlightColor)
 {
     if (InBound(x, y)) {
         highlightedTiles.Add(grid[x, y]);
         grid[x, y].HighlightColor = highlightColor;
     }
 }