public void Tick(int tickNumber) { int startIndex = traversePattern[tickNumber % TraverseStep]; for (int i = startIndex; i < map.Volume; i += TraverseStep) { Block targetBlock = (Block)map.Blocks[i]; switch (targetBlock) { case Block.Grass: TriggerGrass(map.X(i), map.Y(i), map.Z(i)); break; case Block.YellowFlower: case Block.RedFlower: TriggerFlower(map.X(i), map.Y(i), map.Z(i)); break; case Block.BrownMushroom: case Block.RedMushroom: TriggerMushroom(map.X(i), map.Y(i), map.Z(i)); break; case Block.Sapling: TriggerSapling(map.X(i), map.Y(i), map.Z(i)); break; } } if (tickNumber % TraverseStep == 0) { RandomizeTraversal(); } }
public WaterPhysics([NotNull] Map map) { if (map == null) { throw new ArgumentNullException("map"); } this.map = map; spongeData = new BitList(map.Volume); fixed(byte *ptr = map.Blocks) { for (int i = 0; i < map.Volume; i++) { if ((Block)ptr[i] == Block.Sponge) { SpongePlacedUpdateCoverage(map.X(i), map.Y(i), map.Z(i)); } } } }