示例#1
0
        /// <summary>
        /// Paints currently selected parquets at the given position.
        /// </summary>
        /// <param name="in_position">Where to paint.</param>
        /// <returns><c>true</c>, if location was painted correctly, <c>false</c> if an error occured.</returns>
        public bool PaintAtLocation(Vector2Int in_position)
        {
            var result = true;
            var error  = "";

            if (_parquetPaintPattern.IsSet(ParquetMask.Floor))
            {
                error += _currentRegion.TrySetFloor(_floorToPaint, in_position)
                    ? ""
                    : " floor ";
            }
            if (_parquetPaintPattern.IsSet(ParquetMask.Block))
            {
                error += _currentRegion.TrySetBlock(_blockToPaint, in_position)
                    ? ""
                    : " block ";
            }
            if (_parquetPaintPattern.IsSet(ParquetMask.Furnishing))
            {
                error += _currentRegion.TrySetFurnishing(_furnishingToPaint, in_position)
                    ? ""
                    : " furnishing ";
            }
            if (_parquetPaintPattern.IsSet(ParquetMask.Collectible))
            {
                error += _currentRegion.TrySetCollectible(_collectibleToPaint, in_position)
                    ? ""
                    : " collectible ";
            }

            if (!string.IsNullOrEmpty(error))
            {
                Error.Handle($"Error at position {in_position}.  Could not assign these parquets: {error}");
                result = false;
            }

            return(result);
        }