Esempio n. 1
0
    public void AddOverlay(Vector3Int cellPosition, OverlayTile overlayTile, Matrix4x4?transformMatrix = null,
                           Color?color = null)
    {
        //use remove methods to remove overlay instead
        if (overlayTile == null)
        {
            return;
        }

        cellPosition.z = 0;

        //Dont add the same overlay twice
        if (HasOverlay(cellPosition, overlayTile))
        {
            return;
        }

        var overlayPos = metaTileMap.GetFreeOverlayPos(cellPosition, overlayTile.LayerType);

        if (overlayPos == null)
        {
            return;
        }

        cellPosition = overlayPos.Value;

        InternalUpdateTile(cellPosition, overlayTile, transformMatrix, color);

        AlertClients(cellPosition, overlayTile.TileType, overlayTile.OverlayName, transformMatrix, color);

        AddToChangeList(cellPosition, overlayTile.LayerType, overlayTile.TileType, overlayTile.OverlayName, transformMatrix: transformMatrix, color: color);
    }