Exemple #1
0
    IEnumerator ChangeTilePositionWithLerp(Vector3Int actualPosition, Vector3Int top)
    {
        mapInfo.SetThatCellIsEmptyOrNot(top, true);
        yield return(tilemapManager.StartCoroutine(tilemap.LerpTileToPositionContinuous(top, actualPosition, lerpTime)));

        mapInfo.SetThatCellIsEmptyOrNot(actualPosition, false);
    }
Exemple #2
0
    public void FillUnAvailableTiles(Tilemap tilemap, Tile empty)
    {
        if (mapInfo.unavailablePlacesInTilemap.positions.Count == 0)
        {
            return;
        }

        List <Vector3Int> toRemove = new List <Vector3Int>();

        foreach (var positionOfUnavailable in mapInfo.unavailablePlacesInTilemap.positions)
        {
            if (!tilemap.HasTile(positionOfUnavailable) && mapInfo.IsCellEmpty(positionOfUnavailable))
            {
                tilemap.SetTile(positionOfUnavailable, empty);
                // musimy dodać pusty element do kamieni bo po skosie można przemieszczać elementy tylko gdy są pod kamieniami
                // we have to add an empty element to the stones because diagonally you can move the elements only when they are under the stones
                mapInfo.rocks.SetPositionOfRock(positionOfUnavailable);
                mapInfo.SetThatCellIsEmptyOrNot(positionOfUnavailable, false);
            }
        }
        foreach (var item in toRemove)
        {
            mapInfo.unavailablePlacesInTilemap.positions.Remove(item);
        }
    }