public WorleyNoise.PointData RandomPointData(WorleyNoise cellWorley) { int x = UnityEngine.Random.Range(-5000, 5000); int z = UnityEngine.Random.Range(-5000, 5000); return(cellWorley.GetPointData(x, z)); }
WorleyNoise.PointData GetPointData(float3 position) { WorleyNoise.PointData data = worley.GetPointData(position.x, position.z); data.pointWorldPosition = position; data.isSet = true; return(data); }
bool UpdateCurrentCellIndex() { if (playerSystem.player == null) { return(false); } float3 roundedPosition = math.round(playerSystem.player.transform.position); int2 index = worley.GetPointData(roundedPosition.x, roundedPosition.z).currentCellIndex; if (index.Equals(previousCellIndex)) { return(false); } else { previousCellIndex = currentCellIndex; currentCellIndex = index; return(true); } }
void DebugWorley() { if (playerSystem.player == null) { return; } float3 playerPosition = math.round(playerSystem.player.transform.position); WorleyNoise.PointData point = debugWorley.GetPointData(playerPosition.x, playerPosition.z); Text("distance2Edge", point.distance2Edge.ToString()); Text("group", topologyUtil.CellGrouping(point.currentCellIndex).ToString()); Text("cell index", point.currentCellIndex.ToString()); worleyCurrentMarker.transform.position = math.round(point.currentCellPosition) + new float3(0.5f, cellSystem.GetHeightAtPosition(point.currentCellPosition) + 1, 0.5f); worleyAdjacentMarker.transform.position = math.round(point.adjacentCellPosition) + new float3(0.5f, cellSystem.GetHeightAtPosition(point.adjacentCellPosition) + 1, 0.5f); }