Exemplo n.º 1
0
        public void Vector2dTest()
        {
            if (!TestRuntime.CheckXcodeVersion(8, 0))
            {
                Assert.Ignore("Ignoring GameplayKit tests: Requires iOS10+");
            }

            var size   = new Vector2d(1.0, 1.0);
            var origin = new Vector2d(0, 0);
            var sample = new Vector2i(100, 100);

            using (var noise = new GKNoise(GKCylindersNoiseSource.Create(1)))
                using (var baseMap = new GKNoiseMap(noise))
                    using (var map = new GKNoiseMap(noise, size, origin, sample, false)) {
                        Assert.NotNull(baseMap, "baseMap is null");
                        Assert.NotNull(map, "baseMap is null");

                        Assert.AreEqual(size, map.Size, "map size is different");
                        Assert.AreEqual(size, baseMap.Size, "baseMap size is different");
                        Assert.AreEqual(origin, map.Origin, "map origin is different");
                        Assert.AreEqual(origin, baseMap.Origin, "baseMap origin is different");
                        Assert.AreEqual(sample, map.SampleCount, "map sample is different");
                        Assert.AreEqual(sample, baseMap.SampleCount, "baseMap sample is different");
                    }
        }
Exemplo n.º 2
0
        public void Vector3dTest()
        {
            if (!TestRuntime.CheckXcodeVersion(8, 0))
            {
                Assert.Ignore("Ignoring GameplayKit tests: Requires iOS10+");
            }

            using (var noise = new GKNoise(GKCheckerboardNoiseSource.Create(5))) {
                var delta = new Vector3d(1 / 8, 0, 1 / 3);
                Assert.DoesNotThrow(() => noise.Move(delta), "Move");

                var radians = new Vector3d(0, Math.PI / 3, 0);
                Assert.DoesNotThrow(() => noise.Rotate(radians), "Rotate");

                var factor = new Vector3d(2, 1, 1.5);
                Assert.DoesNotThrow(() => noise.Scale(factor), "Scale");
            }
        }