A Block which is displayed on the interface
 public InterfaceBlock(GraphicalBlock block)
 {
     this.ItemGraphics = block.ItemGraphics;
     this.MapCoordinate = block.MapCoordinate;
     this.TileGraphics = block.TileGraphics;
     this.ActorGraphics = block.ActorGraphics;
     this.OverlayGraphic = block.OverlayGraphic;
     this.WasVisited = block.WasVisited;
     this.IsOld = block.IsOld;
 }
 /// <summary>
 /// Gets a graphical block whch exists on a particular point, with a global overlay
 /// </summary>
 /// <param name="point"></param>
 /// <param name="globalOverlay"></param>
 /// <returns></returns>
 public static GraphicalBlock GetBlockAtPoint(MapCoordinate point, GlobalOverlay globalOverlay)
 {
     switch (point.MapType)
     {
         case (DRObjects.Enums.MapType.GLOBAL)
         :
             try
             {
                 return GameState.GlobalMap.GetBlockAtCoordinate(point).ConvertToGraphicalBlock(globalOverlay);
             }
             catch
             {//send an empty one
                 GraphicalBlock block = new GraphicalBlock();
                 block.MapCoordinate = point;
                 return block;
             }
         case (DRObjects.Enums.MapType.LOCAL)
         :
             return GameState.LocalMap.GetBlockAtCoordinate(point).ConvertToGraphicalBlock();
         default:
             throw new NotImplementedException("There is no map manager for that type");
     }
 }
Beispiel #3
0
        /// <summary>
        /// Converts a particular block into a graphical block
        /// </summary>
        /// <returns></returns>
        public GraphicalBlock ConvertToGraphicalBlock()
        {
            GraphicalBlock block = new GraphicalBlock();
            block.TileGraphics = this.Tile.Graphics.ToArray();
            List<SpriteData> itemGraphics = new List<SpriteData>();
            List<SpriteData> actorGraphics = new List<SpriteData>();

            if (this.GetTopMapItem() != null)
            {
                //go through all the items and add them to the list in order
                foreach (MapItem item in this.mapItems.Where(mi => mi.IsActive))
                {
                    if (item.GetType() == typeof(LocalCharacter))
                    {
                        actorGraphics.AddRange(item.Graphics);
                    }
                    else
                    {
                        itemGraphics.AddRange(item.Graphics);
                    }
                }

            }

            block.ActorGraphics = actorGraphics.ToArray();
            block.ItemGraphics = itemGraphics.ToArray();
            block.MapCoordinate = this.Tile.Coordinate;
            block.WasVisited = this.WasVisited;
            block.IsSeeThrough = this.IsSeeThrough;

            return block;
        }
Beispiel #4
0
        public GraphicalBlock ConvertToGraphicalBlock(GlobalOverlay overlay)
        {
            GraphicalBlock block = new GraphicalBlock();
            block.TileGraphics = this.Tile.Graphics.ToArray();
            List<SpriteData> itemGraphics = new List<SpriteData>();

            if (this.GetTopItem() != null)
            {
                //go through all the items and add them to the list in order
                foreach (MapItem item in this.mapItems)
                {
                    itemGraphics.Add(item.Graphic);
                }

            }

            block.ItemGraphics = itemGraphics.ToArray();
            block.MapCoordinate = this.Tile.Coordinate;
            block.WasVisited = this.WasVisited;

            //get the overlay images if its a global tile

            if (this.Tile is GlobalTile)
            {
                block.OverlayGraphic = (this.Tile as GlobalTile).GetGraphicsByOverlay(overlay);
            }

            return block;
        }