public override void OnNeighbourChange(Chunk chunk, BlockNeighbour blockChanged) { switch (blockChanged) { case BlockNeighbour.Top: TopBlock = chunk.GetBlockAtIndex(indexX, indexY + 1); break; case BlockNeighbour.Right: TopBlock = chunk.GetBlockAtIndex(indexX + 1, indexY); break; case BlockNeighbour.Bottom: TopBlock = chunk.GetBlockAtIndex(indexX, indexY - 1); break; case BlockNeighbour.Left: TopBlock = chunk.GetBlockAtIndex(indexX - 1, indexY); break; } }
private void UpdateBlock(string cacheName,int x, int y, int z, BlockNeighbour[] connected,IPathfindingAgent agent) { var cache = nodes [cacheName]; cache [x, y, z].LValue = 0; cache [x, y, z].RValue = 0; cache [x, y, z].BValue = 0; cache [x, y, z].FValue = 0; for (int i = 0; i < connected.Length; i++) { var connect_blocks = connected [i].block; if (agent.canUseForPathfinding (connect_blocks)) { int xPosition = ((int)connect_blocks.intPosition.x); int zPosition = ((int)connect_blocks.intPosition.z); int x_diff = xPosition- x; int z_diff = zPosition - z; if (x_diff == 1 ) { //float estimatedReward = futureState.RValue; cache [x, y, z].RValue =.00001f; } else if (x_diff == -1) { //float estimatedReward = futureState.LValue; cache [x, y, z].LValue =.00001f; } else if (z_diff == 1) { //float estimatedReward = futureState.FValue; cache [x, y, z].FValue = .00001f; } else if (z_diff == -1) { //float estimatedReward = futureState.BValue; cache [x, y, z].BValue = .00001f; } } } }
public virtual void OnNeighbourChange(Chunk chunk, BlockNeighbour blockChanged) { }