public void TestConsolidation() { var vectorA = new HexVector { PrimaryComponent = new HexVectorComponent(HexAxis.C, 5), SecondaryComponent = new HexVectorComponent(HexAxis.E, 9) }; _utilityLibrary.ConsolidateVector(vectorA); TestChecksUtility.CheckComponent(vectorA.PrimaryComponent, HexAxis.D, 5); TestChecksUtility.CheckComponent(vectorA.SecondaryComponent, HexAxis.E, 4); var vectorB = new RawHexVector(); vectorB.AddComponent(HexAxis.A, 1); vectorB.AddComponent(HexAxis.B, 4); vectorB.AddComponent(HexAxis.C, 3); vectorB.AddComponent(HexAxis.E, 7); vectorB.AddComponent(HexAxis.Up, 2); vectorB.AddComponent(HexAxis.Up, 3); vectorB.AddComponent(HexAxis.Down, 5); var resultB = _utilityLibrary.ConsolidateAndCopyVector(vectorB); TestChecksUtility.CheckComponent(resultB.PrimaryComponent, HexAxis.D, 2); resultB.SecondaryComponent.Should().Be(HexVectorComponent.Zero); resultB.VerticalComponent.Should().Be(HexVectorComponent.Zero); }
public void Move(HexGridCoordinate position, HexAxis direction, uint distance) { position.AddComponent(new HexVectorComponent(direction, (int)distance)); _hexVectorUtility.ConsolidateVector(position); EliminateBeComponent(position); }