Example #1
0
        /// <summary> Calculates if the tile at the given <paramref name="x"/> and <paramref name="y"/> positions can be replaced with this <see cref="Tile{T}"/>. </summary>
        /// <param name="tilemap"> The tilemap. </param>
        /// <param name="x"> The x axis of the position. </param>
        /// <param name="y"> The y axis of the position. </param>
        /// <returns> True if this tile can be placed, otherwise; false. </returns>
        public override bool CanPlace(BaseTilemap <FloorTileData> tilemap, int x, int y)
        {
            // Get the object tilemap.
            BaseTilemap <ObjectTileData> objectMap = tilemap.WorldMap.GetTilemap <ObjectTileData>();

            // If there is an object at this position and it cannot support this type of flooring, return false.
            if (objectMap.GetTile(x, y) is ObjectTile objectTile && !objectTile.FloorIsValid(this))
            {
                return(false);
            }

            // If the previous checks have passed, return true as the placement is valid.
            return(true);
        }
Example #2
0
 /// <summary> Calculates if the <see cref="Tile{T}"/> at the given <paramref name="x"/> and <paramref name="y"/> positions is a valid floor compared to this <see cref="Tile{T}"/>'s <see cref="RequiredFloor"/>. </summary>
 /// <param name="floorMap"> The tilemap of the floor. </param>
 /// <param name="x"> The x axis of the position. </param>
 /// <param name="y"> The y axis of the position. </param>
 /// <returns> True if the tile is a valid floor, otherwise; false. </returns>
 public bool FloorIsValid(BaseTilemap <FloorTileData> floorMap, int x, int y) => FloorIsValid(floorMap.GetTile(x, y));
Example #3
0
 public override void OnTick(BaseTilemap <FloorTileData> tilemap, int x, int y)
 {
     // Try to spread to the adjacent tiles.
     trySpread(tilemap, tilemap.GetTile(x, y), x, y);
 }