Example #1
0
 /// <inheritdoc/>
 public override void HandleRegion()
 {
     if (Point2.HasShift)
     {
         m_CubeFill.Set(Point1.Over, Point2.Over, m_DeleteArea);
         BlockWorldEditor.BlockWorld.SetBlocks(m_CubeFill);
     }
     else
     {
         m_CubeFill.Set(Point1.Inside, Point2.Inside, FillPattern);
         BlockWorldEditor.BlockWorld.SetBlocks(m_CubeFill);
     }
 }
Example #2
0
        public void FillRegion()
        {
            var fillPattern = new Mock <IFillPattern>();

            fillPattern.Setup(p => p.GetBlockID(It.IsAny <BlockPosition>())).Returns(2);

            var p1 = new BlockPosition(5, 1, -5);
            var p2 = new BlockPosition(0, 10, -5);

            var tool = new CuboidFill();

            tool.Set(p1, p2, fillPattern.Object);

            List <BlockPlacement> placements = new List <BlockPlacement>();

            foreach (var b in tool.GetBlocks())
            {
                placements.Add(b);
            }

            Assert.AreEqual(60, placements.Count);
            Assert.AreEqual(0, placements.Select(x => x.Position).GroupBy(x => x).Where(g => g.Count() > 1).Count());
            Assert.AreEqual(1, placements.Select(x => x.BlockID).GroupBy(x => x).Count());
            fillPattern.Verify(p => p.GetBlockID(It.IsAny <BlockPosition>()), Times.Exactly(60));
        }
Example #3
0
 /// <inheritdoc/>
 public override void HandleRegion()
 {
     cubeFill.Set(Point1.Inside, Point2.Inside, FillPattern);
     World.SetBlocks(cubeFill);
 }