Esempio n. 1
0
        /// <summary>
        /// Visualizes the map as a string with merged layers.
        /// Intended for Console debugging.
        /// </summary>
        /// <returns>A <see langword="string"/> that represents the current map.</returns>
        internal string DumpMap()
        {
            var representation = new StringBuilder(DimensionsInParquets.Magnitude());

            #region Compose visual represenation of contents.
            for (var x = 0; x < DimensionsInParquets.X; x++)
            {
                for (var y = 0; y < DimensionsInParquets.Y; y++)
                {
                    var parquet = GameObjectID.None != _parquetDefintion[y, x].Collectible
                        ? All.Parquets.Get <ParquetParent>(_parquetDefintion[y, x].Collectible)
                        : GameObjectID.None != _parquetDefintion[y, x].Furnishing
                            ? All.Parquets.Get <ParquetParent>(_parquetDefintion[y, x].Furnishing)
                            : GameObjectID.None != _parquetDefintion[y, x].Block
                                ? All.Parquets.Get <ParquetParent>(_parquetDefintion[y, x].Block)
                                : GameObjectID.None != _parquetDefintion[y, x].Floor
                                    ? All.Parquets.Get <ParquetParent>(_parquetDefintion[y, x].Floor)
                                    : null;

                    representation.Append(parquet?.ToString() ?? "~");
                }
                representation.AppendLine();
            }
            #endregion

            return(representation.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Visualizes the map as a string, listing layers separately.
        /// Intended for Console debugging.
        /// </summary>
        /// <returns>A <see langword="string"/> that represents the current map.</returns>
        public string DumpMapWithLayers()
        {
            var floorRepresentation        = new StringBuilder(DimensionsInParquets.Magnitude());
            var blocksRepresentation       = new StringBuilder(DimensionsInParquets.Magnitude());
            var furnishingsRepresentation  = new StringBuilder(DimensionsInParquets.Magnitude());
            var collectiblesRepresentation = new StringBuilder(DimensionsInParquets.Magnitude());

            #region Compose visual represenation of contents.
            for (var x = 0; x < DimensionsInParquets.X; x++)
            {
                for (var y = 0; y < DimensionsInParquets.Y; y++)
                {
                    floorRepresentation.Append(GameObjectID.None != _parquetDefintion[y, x].Floor
                        ? All.Parquets.Get <Floor>(_parquetDefintion[y, x].Floor).ToString()
                        : "~");
                    blocksRepresentation.Append(GameObjectID.None != _parquetDefintion[y, x].Block
                        ? All.Parquets.Get <Block>(_parquetDefintion[y, x].Block).ToString()
                        : " ");
                    furnishingsRepresentation.Append(GameObjectID.None != _parquetDefintion[y, x].Furnishing
                        ? All.Parquets.Get <Furnishing>(_parquetDefintion[y, x].Furnishing).ToString()
                        : " ");
                    collectiblesRepresentation.Append(GameObjectID.None != _parquetDefintion[y, x].Collectible
                        ? All.Parquets.Get <Collectible>(_parquetDefintion[y, x].Collectible).ToString()
                        : " ");
                }
                floorRepresentation.AppendLine();
                blocksRepresentation.AppendLine();
                furnishingsRepresentation.AppendLine();
                collectiblesRepresentation.AppendLine();
            }
            #endregion

            return($"Floor:\n{floorRepresentation}\n" +
                   $"Blocks:\n{blocksRepresentation}\n" +
                   $"Furnishings:\n{furnishingsRepresentation}\n" +
                   $"Collectibles:\n{collectiblesRepresentation}");
        }