예제 #1
0
 private void HandlePlacingBlock(bool hit, Vector3 hitPosition, Vector3 hitNormal)
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         BlockSpacePosition newBlockPosition = BlockSpacePosition.CreateFromVector3(hitPosition + hitNormal);
         if (hit && ironVoxel.Service.CollisionService.PotentialEntityCollision(newBlockPosition) == false)
         {
             Vector3 setPosition = hitPosition + hitNormal;
             ironVoxel.Service.ChunkRepository.SetBlockAtPosition(setPosition, buildType);
         }
     }
 }
예제 #2
0
        public Chunk GetChunkAtPosition(Vector3 position)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

            return(GetChunkAtPosition(blockspacePosition));
        }
예제 #3
0
        public void RemoveBlockAtPosition(Vector3 position, Chunk.RemoveBlockCallback callback)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

            RemoveBlockAtPosition(blockspacePosition, callback);
        }
예제 #4
0
        public void SetBlockAtPosition(Vector3 position, BlockType type)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

            SetBlockAtPosition(blockspacePosition, type, true);
        }
예제 #5
0
        public Block GetBlockAtPosition(Vector3 position)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

            return(GetBlockAtPosition(blockspacePosition).block);
        }
예제 #6
0
        public ChunkBlockPair GetBlockAtPosition(Vector3 position, Chunk hintChunk)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

            return(GetBlockAtPosition(blockspacePosition, hintChunk));
        }