Пример #1
0
    public void RemoveAllOverlays(Vector3Int cellPosition, LayerType layerType, bool onlyIfCleanable = false)
    {
        cellPosition.z = 0;

        var overlayPos = metaTileMap.GetAllOverlayPos(cellPosition, layerType);

        if (overlayPos == null || overlayPos.Count == 0)
        {
            return;
        }

        foreach (var overlay in overlayPos)
        {
            cellPosition = overlay;

            if (onlyIfCleanable)
            {
                //only remove it if it's a cleanable tile
                var tile = metaTileMap.GetTile(cellPosition, layerType) as OverlayTile;
                //it's not an overlay tile or it's not cleanable so don't remove it
                if (tile == null || !tile.IsCleanable)
                {
                    continue;
                }
            }

            InternalRemoveTile(cellPosition, layerType);

            SpawnSafeThread.RemoveTileMessageSend(networkMatrix.MatrixSync.netId, cellPosition, layerType);

            AddToChangeList(cellPosition, layerType);
        }
    }
Пример #2
0
    public LayerTile RemoveTile(Vector3Int cellPosition, LayerType layerType)
    {
        var layerTile = metaTileMap.GetTile(cellPosition, layerType);

        if (metaTileMap.HasTile(cellPosition, layerType))
        {
            InternalRemoveTile(cellPosition, layerType);

            SpawnSafeThread.RemoveTileMessageSend(networkMatrix.MatrixSync.netId, cellPosition, layerType);

            AddToChangeList(cellPosition, layerType);

            if (layerType == LayerType.Floors || layerType == LayerType.Base)
            {
                OnFloorOrPlatingRemoved.Invoke(cellPosition);
            }

            RemoveOverlaysOfType(cellPosition, LayerType.Effects, OverlayType.Damage);

            return(layerTile);
        }

        return(layerTile);
    }