Пример #1
0
        public void TestComponentReplacement()
        {
            var vectorA = new RawHexVector();

            vectorA.AddComponent(HexAxis.B, 3);
            vectorA.AddComponent(HexAxis.B, 2);
            vectorA.AddComponent(HexAxis.E, 7);
            vectorA.AddComponent(HexAxis.A, 2);
            vectorA.AddComponent(HexAxis.C, 2);

            _utilityLibrary.GetMagnitudeAlongDirection(vectorA, HexAxis.B).Should().Be(5);
            _utilityLibrary.GetMagnitudeAlongCardinalDirection(vectorA, HexAxis.B).Should().Be(-2);

            _utilityLibrary.AddOrUpdateVectorDirection(vectorA, 1, HexAxis.B);
            _utilityLibrary.GetMagnitudeAlongDirection(vectorA, HexAxis.B).Should().Be(1);
            _utilityLibrary.GetMagnitudeAlongCardinalDirection(vectorA, HexAxis.B).Should().Be(-6);

            var vectorB = new RawHexVector();

            vectorB.AddComponent(HexAxis.F, 3);

            _utilityLibrary.GetMagnitudeAlongDirection(vectorB, HexAxis.C).Should().Be(0);
            _utilityLibrary.GetMagnitudeAlongCardinalDirection(vectorB, HexAxis.C).Should().Be(-3);

            _utilityLibrary.AddOrUpdateVectorDirection(vectorB, 5, HexAxis.C);
            _utilityLibrary.GetMagnitudeAlongDirection(vectorB, HexAxis.C).Should().Be(5);
            _utilityLibrary.GetMagnitudeAlongCardinalDirection(vectorB, HexAxis.C).Should().Be(2);
        }
Пример #2
0
 public void AssginDirectionValue(HexAxis direction, uint newValue)
 {
     _hexVectorUtility.AddOrUpdateVectorDirection(Vectors, (int)newValue, direction);
     OnVelocityChanged();
 }