本文整理汇总了C#中Point3.ToChunkCoord方法的典型用法代码示例。如果您正苦于以下问题:C# Point3.ToChunkCoord方法的具体用法?C# Point3.ToChunkCoord怎么用?C# Point3.ToChunkCoord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3.ToChunkCoord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddChunk
// Add overrides for Vector3 and chunk coord?
public static Chunk AddChunk(Point3 worldBlockCoord)
{
Chunk chunk = GetChunk(worldBlockCoord);
Point3 chunkCoord = worldBlockCoord.ToChunkCoord();
if (chunk == null) {
chunk = new Chunk(chunkSize, chunkCoord.ToVector3() * chunkSize * blockSize);
chunks.Add(GetHash(chunkCoord), chunk);
}
return chunk;
}
示例2: UpdateNeighbour
private void UpdateNeighbour(Voxel v, Point3 worldCoord)
{
BlockInfo bi =
SurfaceManager.GetSurface(
SurfaceManager.GetID(
GetNeighbours(worldCoord)));
v.SetRotation(bi.rotation);
int hash = ChunkManager.GetHash(worldCoord.ToChunkCoord());
Transform chunkContainer = null;
foreach (Transform child in transform) {
if (child.name == hash.ToString()) {
chunkContainer = child;
break;
}
}
if (chunkContainer == null) {
PlaceBlock(worldCoord, hash, bi);
return;
}
Mesh mesh = Resources.Load("Meshes/Dev/"+bi.meshName) as Mesh;
string name = Name(worldCoord);
foreach (Transform block in chunkContainer) {
if (block.name == name) {
block.GetComponent<MeshFilter>().sharedMesh = mesh;
block.transform.localRotation = bi.rotation;
}
}
}
示例3: GetChunk
public static Chunk GetChunk(Point3 worldBlockCoord)
{
Chunk chunk;
chunks.TryGetValue(GetHash(worldBlockCoord.ToChunkCoord()), out chunk);
return chunk;
}