// Update is called once per frame
 void FixedUpdate()
 {
     blockHitInfo = ChunkAndBlockSearch.Raycast(MainCamera, 4, BlockLayerMask, false);
     if (blockHitInfo.Success)
     {
         block = blockHitInfo.block.BlockWorldPosition(blockHitInfo.chunk);
     }
 }
示例#2
0
    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();
    }
示例#3
0
    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);
        }
    }