예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="field"></param>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (Decoration == null || IsHidden)
            {
                return;
            }

            TileDrawing td = DisplayCoordinates.GetPit(position);

            if (td == null)
            {
                return;
            }



            if (IsActivated)
            {
                //batch.FillRectangle(new Rectangle(td.Location, new Size(50, 50)), Color.Red);
                Decoration.Draw(batch, field.Maze.FloorPitDeco, position);
            }
            //TODO
            //if (td != null && !IsHidden)
            //    batch.DrawTile(TileSet, td.ID, td.Location, Color.White, 0.0f, td.Effect, 0.0f);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="field"></param>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            // Foreach wall side
            foreach (TileDrawing td in DisplayCoordinates.GetWalls(position))
            {
                // Not the good side
                if (Compass.GetDirectionFromView(direction, td.Side) != Side)
                {
                    continue;
                }

                DecorationSet decoset = field.Maze.Decoration;
                if (decoset == null)
                {
                    return;
                }

                Decoration deco = decoset.GetDecoration(IsActivated ? ActivatedDecoration : DeactivatedDecoration);
                if (deco == null)
                {
                    return;
                }

                deco.DrawDecoration(batch, decoset, position, Compass.IsSideFacing(direction, Side));
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        void RenderActivated()
        {
            ActivatedGLBox.MakeCurrent();
            Display.ClearBuffers();

            Batch.Begin();

            // Background
            Batch.DrawTile(Maze.WallTileset, 0, Point.Empty);

            // Render the walls
            foreach (TileDrawing tmp in DisplayCoordinates.GetWalls(ViewFieldPosition.L))
            {
                Batch.DrawTile(Maze.WallTileset, tmp.ID, tmp.Location);
            }

            // Draw decoration
            if (DecorationSet != null)
            {
                DecorationSet.Draw(Batch, (int)ActivatedIdBox.Value, ViewFieldPosition.L);
            }

            Batch.End();

            ActivatedGLBox.SwapBuffers();
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="field"></param>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (TileSet == null)
            {
                return;
            }

            // Upstair or downstair ?
            int delta = Type == StairType.Up ? 0 : 13;

            foreach (TileDrawing tmp in DisplayCoordinates.GetStairs(position))
            {
                batch.DrawTile(TileSet, tmp.ID + delta, tmp.Location, Color.White, 0.0f, tmp.Effect, 0.0f);
            }
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="field"></param>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (Decoration == null || IsHidden)
            {
                return;
            }

            TileDrawing td = DisplayCoordinates.GetFloorPlate(position);

            if (td == null)
            {
                return;
            }

            Decoration.Draw(batch, DecorationPrimary, position);
        }
예제 #6
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);
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Initialize the dungeon
        /// </summary>
        /// <returns>True on success</returns>
        public bool Init()
        {
            Trace.WriteLine("[Dungeon] : Init()");

            // Loads maze display coordinates
            DisplayCoordinates.Load();

            LoadItemTileSet();

            foreach (Maze maze in Mazes.Values)
            {
                maze.Init();
            }

            Mouse.LoadTileSet(ItemTileSet);

            return(true);
        }
예제 #8
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));
        }
예제 #9
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 view)
        {
            if (TileSet == null)
            {
                return;
            }

            TileDrawing td   = null;
            TileSet     wall = Square.Maze.WallTileset;


            // TODO: Under the door, draw sides
            if (field.GetBlock(ViewFieldPosition.L).IsWall&& position == ViewFieldPosition.Team)
            {
                //		td = DisplayCoordinates.GetDoor(ViewFieldPosition.Team);
                //		if (td != null)
                //			batch.DrawTile(overlay, td.ID, td.Location, Color.White, 0.0f, td.Effect, 0.0f);
                if (field.Maze.Decoration != null)
                {
                    field.Maze.Decoration.Draw(batch, field.Maze.DoorDeco, position);
                }
            }

            // Draw the door
            else if (((field.Maze.IsDoorNorthSouth(Square.Location) && (view == CardinalPoint.North || view == CardinalPoint.South)) ||
                      (!field.Maze.IsDoorNorthSouth(Square.Location) && (view == CardinalPoint.East || view == CardinalPoint.West))) &&
                     position != ViewFieldPosition.Team)
            {
                td = DisplayCoordinates.GetDoor(position);
                if (td != null)
                {
                    batch.DrawTile(wall, td.ID, td.Location, Color.White, 0.0f, td.Effect, 0.0f);
                    //block.Door.Draw(batch, td.Location, position, view);


                    switch (Type)
                    {
                    case DoorType.Grid:
                        DrawSimpleDoor(batch, 1, td.Location, position);
                        break;

                    case DoorType.Forest:
                        DrawSimpleDoor(batch, 6, td.Location, position);
                        break;

                    case DoorType.Iron:
                        DrawSimpleDoor(batch, 0, td.Location, position);
                        break;

                    case DoorType.Monster:
                        DrawUpDownDoor(batch, 2, td.Location, position);
                        break;

                    case DoorType.Azure:
                        DrawSimpleDoor(batch, 8, td.Location, position);
                        break;

                    case DoorType.Crimson:
                        DrawSimpleDoor(batch, 9, td.Location, position);
                        break;

                    case DoorType.Temple:
                        DrawSimpleDoor(batch, 10, td.Location, position);
                        break;

                    case DoorType.Silver:
                        DrawSimpleDoor(batch, 11, td.Location, position);
                        break;

                    case DoorType.Mantis:
                        DrawSimpleDoor(batch, 12, td.Location, position);
                        break;
                    }
                }
            }
        }