Beispiel #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);
         }
     }
 }
Beispiel #2
0
        public Chunk GetChunkAtPosition(Vector3 position)
        {
            BlockSpacePosition blockspacePosition = BlockSpacePosition.CreateFromVector3(position);

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

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

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

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

            return(GetBlockAtPosition(blockspacePosition, hintChunk));
        }