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); } } }
public Chunk GetChunkAtPosition(Vector3 position) { BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position); return(GetChunkAtPosition(blockspacePosition)); }
public void RemoveBlockAtPosition(Vector3 position, Chunk.RemoveBlockCallback callback) { BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position); RemoveBlockAtPosition(blockspacePosition, callback); }
public void SetBlockAtPosition(Vector3 position, BlockType type) { BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position); SetBlockAtPosition(blockspacePosition, type, true); }
public Block GetBlockAtPosition(Vector3 position) { BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position); return(GetBlockAtPosition(blockspacePosition).block); }
public ChunkBlockPair GetBlockAtPosition(Vector3 position, Chunk hintChunk) { BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position); return(GetBlockAtPosition(blockspacePosition, hintChunk)); }