Ejemplo n.º 1
0
        public void ZeroUnpacksAsZero(Vector3 max, Vector3 precision)
        {
            var packer = new Vector3Packer(max, precision);
            var zero   = Vector3.zero;

            packer.Pack(writer, zero);
            var unpacked = packer.Unpack(GetReader());

            Assert.That(unpacked, Is.EqualTo(zero));
        }
Ejemplo n.º 2
0
        public void UnpacksToSaveValue(Vector3 max, Vector3 precision)
        {
            var packer   = new Vector3Packer(max, precision);
            var expected = new Vector3(
                Random.Range(-max.x, -max.x),
                Random.Range(-max.y, -max.y),
                Random.Range(-max.z, -max.z)
                );

            packer.Pack(writer, expected);
            var unpacked = packer.Unpack(GetReader());

            Assert.That(unpacked.x, Is.EqualTo(expected.x).Within(precision.x));
            Assert.That(unpacked.y, Is.EqualTo(expected.y).Within(precision.y));
            Assert.That(unpacked.z, Is.EqualTo(expected.z).Within(precision.z));
        }