Пример #1
0
        /// <summary>
        /// Draws all alcoves according to the view point
        /// </summary>
        /// <param name="batch">Spritebatch handle</param>
        /// <param name="field">Field of view handle</param>
        /// <param name="position">Position in the field of view</param>
        /// <param name="direction">Looking direction</param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (field.Maze.Decoration == null)
            {
                return;
            }

            // For each wall side, draws the decoration
            foreach (CardinalPoint side in DisplayCoordinates.DrawingWallSides[(int)position])
            {
                Alcove alcove = GetAlcove(Compass.GetDirectionFromView(direction, side));

                // Get the decoration
                Decoration deco = field.Maze.Decoration.GetDecoration(alcove.Decoration);
                if (deco == null)
                {
                    continue;
                }

                // Draw the decoration
                deco.DrawDecoration(batch, field.Maze.Decoration, position, side == CardinalPoint.South);


                // Hide items
                if (alcove.HideItems || side != CardinalPoint.South)
                {
                    continue;
                }



                // Offset the item locations according to the distance
                Vector2 vect = DisplayCoordinates.GetMonsterScaleFactor(position);
                Point   loc  = deco.PrepareLocation(position);
                loc.Offset((int)(deco.ItemLocation.X * vect.X), (int)(deco.ItemLocation.Y * vect.Y));


                // Draw items in the alcove in front of the team
                foreach (Item item in Square.GetItemsFromSide(direction, side))
                {
                    batch.DrawTile(Square.Maze.Dungeon.ItemTileSet, item.GroundTileID, loc,
                                   DisplayCoordinates.GetDistantColor(position), 0.0f,
                                   DisplayCoordinates.GetItemScaleFactor(position), SpriteEffects.None, 0.0f);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Draw the door
        /// </summary>
        /// <param name="batch">Spritebatch to use</param>
        /// <param name="field">View field</param>
        /// <param name="position">Position in the view filed</param>
        /// <param name="view">Looking direction of the team</param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (!IsVisible)
            {
                return;
            }

            TileDrawing td = DisplayCoordinates.GetTeleporter(position);

            if (td == null)
            {
                return;
            }

            Anim.Draw(batch, td.Location, 0.0f, SpriteEffects.None,
                      DisplayCoordinates.GetDistantColor(position),
                      DisplayCoordinates.GetMonsterScaleFactor(position));
        }