public void Init() { var airBlock = new Mock <IMeshBlockDetails>(); airBlock.Setup(b => b.IsSolid).Returns(false); airBlock.Setup(b => b.IsVisible).Returns(false); AirBlock = airBlock.Object; var noCollisionBlock = new Mock <IMeshBlockDetails>(); noCollisionBlock.Setup(b => b.IsSolid).Returns(false); noCollisionBlock.Setup(b => b.IsVisible).Returns(true); NoCollisionBlock = noCollisionBlock.Object; var normalBlock = new Mock <IMeshBlockDetails>(); normalBlock.Setup(b => b.IsSolid).Returns(true); normalBlock.Setup(b => b.IsVisible).Returns(true); NormalBlock = normalBlock.Object; var invisibleBlock = new Mock <IMeshBlockDetails>(); invisibleBlock.Setup(b => b.IsSolid).Returns(true); invisibleBlock.Setup(b => b.IsVisible).Returns(false); InvisibleBlock = invisibleBlock.Object; var differentMaterialBlock = new Mock <IMeshBlockDetails>(); differentMaterialBlock.Setup(b => b.IsSolid).Returns(true); differentMaterialBlock.Setup(b => b.IsVisible).Returns(true); differentMaterialBlock.Setup(b => b.GetMaterialID(It.IsAny <int>())).Returns(1); DifferentMaterialBlock = differentMaterialBlock.Object; var randomTexturesBlock = new Mock <IMeshBlockDetails>(); randomTexturesBlock.Setup(b => b.IsSolid).Returns(true); randomTexturesBlock.Setup(b => b.IsVisible).Returns(true); randomTexturesBlock.Setup(b => b.GetRotation(It.IsAny <int>())).Returns(FaceRotation.Random); RandomTexturesBlock = randomTexturesBlock.Object; ChunkProperties = new ChunkProperties(); ChunkProperties.Reset(default, new GridSize(4));
/// <summary> /// Sets a block type at the position within this chunk. The block may be up to /// one block outside of the chunk bounds. This should only be called from the /// main thread, and should not be called when this chunk properties object is /// being used by the remesh tasks. /// </summary> /// <param name="pos">The position of the block.</param> /// <returns>The block type.</returns> public void SetBlock(BlockPosition pos, IMeshBlockDetails details) { m_Blocks[BlockIndex(pos)] = details; }