Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
d-bucur committed Feb 13, 2021
1 parent 5c43ff1 commit 374579b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Assets/Scripts/Coordinates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static (Vector2Int sectorPos, Vector3Int internalPos) WorldToInternalPos(
Mathf.FloorToInt(pos.z / (float) Sector.sectorSize));
var internalPos = new Vector3Int(
pos.x - sectorPos.x * Sector.sectorSize,
pos.y, // TODO cannot be. all types have different y axis
pos.y,
pos.z - sectorPos.y * Sector.sectorSize
);
return (sectorPos, internalPos);
Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/Sector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ private void SweepMeshFaces() {
for (var z = 0; z < sectorSize; z++) {
for (var y = 0; y < sectorSizeHeight; y++) {
var currentPos = new Vector3Int(x, y, z);
// TODO move if inside Construct face
if (hasLast)
last = ConstructFace(last, currentPos, Direction.UP, Direction.DOWN);
else {
Expand Down
6 changes: 1 addition & 5 deletions Assets/Scripts/WorldChanges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ public class WorldChanges : MonoBehaviour {

public void Add(Vector3Int gridPos, BlockType type) {
_diffs[gridPos] = type;
Debug.Log(String.Format("Added diff: {0}: {1}", gridPos, type));
}

public bool TryGetValue(in Vector3Int pos, out BlockType type) {
var found = _diffs.TryGetValue(pos, out type);
if (found)
Debug.Log(String.Format("Restored diff: {0}: {1}", pos, type));
return found;
return _diffs.TryGetValue(pos, out type);
}
}
1 change: 0 additions & 1 deletion Assets/Scripts/WorldGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ public void DestroyBlock(Vector3Int worldPos) {
var blockType = planePos.y < waterTreshold ? BlockType.Water : BlockType.Empty;
sector.AddBlock(internalPos, blockType);
_worldChanges.Add(planePos, blockType);
Debug.Log("Removed to " + blockType);
// TODO should only add new meshes instead of redrawing the whole sector
sector.FinishGeneratingGrid();
sector.GenerateMesh();
Expand Down

0 comments on commit 374579b

Please sign in to comment.