// Update is called once per frame void FixedUpdate() { blockHitInfo = ChunkAndBlockSearch.Raycast(MainCamera, 4, BlockLayerMask, false); if (blockHitInfo.Success) { block = blockHitInfo.block.BlockWorldPosition(blockHitInfo.chunk); } }
void Awake() { Debug.Assert(size > 1); Debug.Assert((size - 1) % 2 == 0); // make sure it's odd CenterIndex = ChunkAndBlockSearch.FindChunkIndex(Player.position); Chunks = new Chunk[size, size]; Center = new TwoDIndex((size - 1) / 2, (size - 1) / 2); FillArray(); }
void Update() { ChunkIndex playerChunk = ChunkAndBlockSearch.FindChunkIndex(Player.position); if (CenterIndex != playerChunk) { int xDir = playerChunk.ChunkX - CenterIndex.ChunkX; int zDir = playerChunk.ChunkZ - CenterIndex.ChunkZ; CenterIndex = playerChunk; ShiftArray(xDir, zDir); } }