示例#1
0
        /// <summary>
        /// Visualizes the map as a string with merged layers.
        /// Intended for Console debugging.
        /// </summary>
        /// <returns>A <see cref="T:System.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++)
                {
                    // TODO: This fails with TestParquet values.  Do we want to support ToStringing test values??
                    var parquet = EntityID.None != _collectibleLayer[x, y]
                        ? AllParquets.Get <ParquetParent>(_collectibleLayer[x, y])
                        : EntityID.None != _furnishingLayer[x, y]
                            ? AllParquets.Get <ParquetParent>(_furnishingLayer[x, y])
                            : EntityID.None != _blockLayer[x, y]
                                ? AllParquets.Get <ParquetParent>(_blockLayer[x, y])
                                : EntityID.None != _floorLayer[x, y]
                                    ? AllParquets.Get <ParquetParent>(_floorLayer[x, y])
                                    : null;

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

            return(representation.ToString());
        }
示例#2
0
        /// <summary>
        /// Gets all the parquets in the entire map.
        /// </summary>
        /// <returns>A collection of parquets.</returns>
        public IEnumerable <ParquetParent> GetAllParquets()
        {
            var result = new List <ParquetParent>();

            for (var x = 0; x < DimensionsInParquets.X; x++)
            {
                for (var y = 0; y < DimensionsInParquets.Y; y++)
                {
                    var parquetID = _floorLayer[x, y];
                    if (EntityID.None != parquetID)
                    {
                        result.Add(AllParquets.Get <Floor>(parquetID));
                    }
                    parquetID = _blockLayer[x, y];
                    if (EntityID.None != parquetID)
                    {
                        result.Add(AllParquets.Get <Block>(parquetID));
                    }
                    parquetID = _furnishingLayer[x, y];
                    if (EntityID.None != parquetID)
                    {
                        result.Add(AllParquets.Get <Furnishing>(parquetID));
                    }
                    parquetID = _collectibleLayer[x, y];
                    if (EntityID.None != parquetID)
                    {
                        result.Add(AllParquets.Get <Collectible>(parquetID));
                    }
                }
            }

            return(result);
        }
示例#3
0
        /// <summary>
        /// Gets any collectible parquet at the position.
        /// </summary>
        /// <param name="in_position">The position whose collectible is sought.</param>
        /// <returns>The collectible at the given position, or <c>null</c> if there is none.</returns>
        public Collectible GetCollectibleAtPosition(Vector2Int in_position)
        {
            Collectible result = null;

            if (IsValidPosition(in_position))
            {
                result = AllParquets.Get <Collectible>(_collectibleLayer[in_position.X, in_position.Y]);
            }

            return(result);
        }
示例#4
0
        /// <summary>
        /// Gets any furnishing parquet at the position.
        /// </summary>
        /// <param name="in_position">The position whose furnishing  is sought.</param>
        /// <returns>The furnishing  at the given position, or <c>null</c> if there is none.</returns>
        public Furnishing GetFurnishingAtPosition(Vector2Int in_position)
        {
            Furnishing result = null;

            if (IsValidPosition(in_position))
            {
                result = AllParquets.Get <Furnishing>(_furnishingLayer[in_position.X, in_position.Y]);
            }

            return(result);
        }
示例#5
0
        /// <summary>
        /// Gets any block parquet at the position.
        /// </summary>
        /// <param name="in_position">The position whose block is sought.</param>
        /// <returns>The block at the given position, or <c>null</c> if there is none.</returns>
        public Block GetBlockAtPosition(Vector2Int in_position)
        {
            Block result = null;

            if (IsValidPosition(in_position))
            {
                result = AllParquets.Get <Block>(_blockLayer[in_position.X, in_position.Y]);
            }

            return(result);
        }
示例#6
0
        /// <summary>
        /// Gets any floor parquet at the position.
        /// </summary>
        /// <param name="in_position">The position whose floor is sought.</param>
        /// <returns>The floor at the given position, or <c>null</c> if there is none.</returns>
        public Floor GetFloorAtPosition(Vector2Int in_position)
        {
            Floor result = null;

            if (IsValidPosition(in_position))
            {
                result = AllParquets.Get <Floor>(_floorLayer[in_position.X, in_position.Y]);
            }

            return(result);
        }