Exemplo n.º 1
0
        public static void updateMapData(FarmHouse house)
        {
            int width  = house.map.GetLayer("Back").LayerWidth;
            int height = house.map.GetLayer("Back").LayerHeight;

            Color[] data = new Color[width * height];
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    bool traversible = house.isTilePassable(new xTile.Dimensions.Location(x, y), Game1.viewport);
                    bool placeable   = house.isTileLocationTotallyClearAndPlaceable(new Vector2(x, y));
                    bool isVoid      = (!house.isTileOnMap(new Vector2(x, y)) || isTileVoid(house.map, x, y));
                    bool wall        = house.isTileOnWall(x, y);
                    data[x + (y * width)] = (isVoid ? Color.Black : wall ? Color.Lavender : traversible && placeable ? Color.White : traversible ? Color.LightBlue : placeable ? Color.Red : Color.Black);
                }
            }

            drawAStarPath(house, ref data);


            mapData = new Image.ImageInfo(data, width, height);
        }