コード例 #1
0
        public Tile GetTile(DoorTileData t)
        {
            SetMinimapTile(Color.Purple);

            if (t.Door != null)
            {
                t.Door.Processed = true;

                var door = new DungeonContent.Items.Door(Vector3.Zero, t.Door.HasButton);

                door.Graphic.Texture = builder.defaultDoorTexture;
                if (t.Door.DoorAppearance)
                {
                    door.Graphic.Texture = builder.defaultMapDoorTypeTexture;
                }

                if (t.Door.OrnamentationID != null)
                {
                    door.Graphic.Texture = builder.DoorTextures[t.Door.OrnamentationID.Value - 1];
                }

                return(new Door(tilePosition, t.Orientation == Orientation.WestEast, t.State == DoorState.Open || t.State == DoorState.Bashed, door));
            }
            else
            {
                throw new InvalidOperationException("Invalid map format. Door item should be at door tile.");
            }
        }
コード例 #2
0
        public Tile GetTile(DoorTileData t)
        {
            if (t.Door == null)
            {
                throw new ArgumentNullException("Invalid map format. Door item should be at door tile.");
            }

            SetMinimapTile(Color.Purple);

            var initializer = new DoorInitializer {
                Door = CreateDoor(t)
            };

            initializer.HasButton = t.Door.HasButton;


            initializer.Direction = t.Orientation == Orientation.NorthSouth ? MapDirection.North : MapDirection.East;

            var res = new DoorTile(initializer);

            sidesCreator.SetupSidesAsync(initializer, currentGridPosition, res);
            res.Renderer     = builder.Factories.RenderersSource.GetDoorTileRenderer(res, builder.WallTexture, builder.DoorButtonTexture);
            this.initializer = initializer;
            return(res);
        }
コード例 #3
0
        public Door CreateDoor(DoorTileData tile)
        {
            var doorInfo = builder.GetCurrentDoor(tile.Door.DoorType);
            var res      = new Door(tile.State == DoorState.Open, doorInfo.Resistance, tile.Door.IsChoppingDestructible, tile.Door.IsFireballDestructible, doorInfo.ItemsPassThrough, doorInfo.CreatureSeeThrough);

            res.Renderer = builder.Factories.RenderersSource.GetDoorRenderer(tile.Door.OrnamentationID == 0 ? builder.DefaultDoorTexture : builder.DoorTextures[tile.Door.OrnamentationID - 1]);
            return(res);
        }