private void OnEnable()
 {
     if (JoinPoint == null)
     {
         JoinPoint = new RelativeVector3();
     }
     if (FirePoint == null)
     {
         FirePoint = new RelativeVector3();
     }
 }
 private void OnEnable()
 {
     if (GunSurfPosition == null)
     {
         GunSurfPosition = new RelativeVector3();
     }
     if (GunCenterPosition == null)
     {
         GunCenterPosition = new RelativeVector3();
     }
 }
Пример #3
0
        public void RelativeVector3Constructor()
        {
            tlog.Debug(tag, $"RelativeVector3Constructor START");

            var testingTarget = new RelativeVector3();

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should return Vector3 instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3Constructor END (OK)");
        }
Пример #4
0
        public void KeyValueRelativeVector3Value()
        {
            tlog.Debug(tag, $"KeyValueRelativeVector3Value START");

            using (RelativeVector3 rVec3 = new RelativeVector3(0, 0, 0))
            {
                keyValue.RelativeVector3Value = rVec3;
                tlog.Debug(tag, "RelativeVector3Value : " + keyValue.RelativeVector3Value);
            }

            tlog.Debug(tag, $"KeyValueRelativeVector3Value END (OK)");
        }
Пример #5
0
        public override string ConvertToString(object value)
        {
            RelativeVector3 vector = value as RelativeVector3;

            if (null != vector)
            {
                return(vector.X.ToString() + " " + vector.Y.ToString() + " " + vector.Z.ToString());
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        public override string ConvertToString(object value)
        {
            RelativeVector3 vector = value as RelativeVector3;

            if (null != vector)
            {
                return(vector.X.ToString() + TypeConverter.UnifiedDelimiter + vector.Y.ToString() + TypeConverter.UnifiedDelimiter + vector.Z.ToString());
            }
            else
            {
                return(null);
            }
        }
Пример #7
0
        public void RelativeVector3GetZ()
        {
            tlog.Debug(tag, $"RelativeVector3GetZ START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            Assert.AreEqual(0.7f, testingTarget.Z, "The Z value of the vector is not correct!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3GetZ END (OK)");
        }
Пример #8
0
        public void RelativeVector3ConstructorWithFloat()
        {
            tlog.Debug(tag, $"RelativeVector3ConstructorWithFloat START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should return Vector3 instance.");

            Assert.AreEqual(0.5f, testingTarget.X, "Retrieved vector.X should be equal to set value");
            Assert.AreEqual(0.6f, testingTarget.Y, "Retrieved vector.Y should be equal to set value");
            Assert.AreEqual(0.7f, testingTarget.Z, "Retrieved vector.Z should be equal to set value");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3ConstructorWithFloat END (OK)");
        }
Пример #9
0
        public void RelativeVector3GetVauleBySubscriptIndex()
        {
            tlog.Debug(tag, $"RelativeVector3GetVauleBySubscriptIndex START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            Assert.AreEqual(0.5f, testingTarget[0], "The value of index[0] is not correct!");
            Assert.AreEqual(0.6f, testingTarget[1], "The value of index[1] is not correct!");
            Assert.AreEqual(0.7f, testingTarget[2], "The value of index[2] is not correct!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3GetVauleBySubscriptIndex END (OK)");
        }
Пример #10
0
        public void RelativeVector3GetHashCode()
        {
            tlog.Debug(tag, $"RelativeVector3GetHashCode START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            var result = testingTarget.GetHashCode();

            Assert.IsTrue(result >= Int32.MinValue && result <= Int32.MaxValue, "The value of hash is out of Integer range");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3GetHashCode END (OK)");
        }
Пример #11
0
        public void RelativeVector3ImplicitToVector3()
        {
            tlog.Debug(tag, $"RelativeVector3ImplicitToVector3 START");

            Vector3 testingTarget = null;

            using (RelativeVector3 relativeVector3 = new RelativeVector3(0.5f, 0.6f, 0.7f))
            {
                testingTarget = relativeVector3;
                Assert.AreEqual(relativeVector3.X, testingTarget.X, "The value of X is not correct.");
                Assert.AreEqual(relativeVector3.Y, testingTarget.Y, "The value of Y is not correct.");
                Assert.AreEqual(relativeVector3.Z, testingTarget.Z, "The value of Z is not correct.");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3ImplicitToVector3 END (OK)");
        }
Пример #12
0
        public void RelativeVector3ImplicitToRelativeVector3()
        {
            tlog.Debug(tag, $"RelativeVector3ImplicitToRelativeVector3 START");

            RelativeVector3 testingTarget = null;

            using (Vector3 vector = new Vector3(0.5f, 0.6f, 0.7f))
            {
                testingTarget = vector;
                Assert.AreEqual(testingTarget.X, vector.X, "The value of X is not correct.");
                Assert.AreEqual(testingTarget.Y, vector.Y, "The value of Y is not correct.");
                Assert.AreEqual(testingTarget.Z, vector.Z, "The value of Z is not correct.");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3ImplicitToRelativeVector3 END (OK)");
        }
Пример #13
0
        public void RelativeVector3NotEqualTo()
        {
            tlog.Debug(tag, $"RelativeVector3NotEqualTo START");

            var testingTarget = new RelativeVector3(1.0f, 0.5f, 0.4f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            using (RelativeVector3 vector = new RelativeVector3(1.0f, 0.5f, 0.6f))
            {
                Assert.IsTrue((testingTarget.NotEqualTo(vector)), "Should be equal");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3NotEqualTo END (OK)");
        }
Пример #14
0
        public void KeyValueRelativeVector3Value()
        {
            tlog.Debug(tag, $"KeyValueRelativeVector3Value START");

            RelativeVector3 b1 = new RelativeVector3(0, 0, 0);
            KeyValue        a1 = new KeyValue
            {
                RelativeVector3Value = b1
            };

            b1 = a1.RelativeVector3Value;

            b1.Dispose();
            a1.Dispose();
            tlog.Debug(tag, $"KeyValueRelativeVector3Value END (OK)");
            Assert.Pass("KeyValueRelativeVector3Value");
        }
Пример #15
0
        public void RelativeVector3DivisionByFloat()
        {
            tlog.Debug(tag, $"RelativeVector3DivisionByFloat START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            var result = testingTarget / 10.0f;

            Assert.Less(Math.Abs(0.05f - result.X), 0.0001f, "The X of the vector is not correct here!");
            Assert.Less(Math.Abs(0.06f - result.Y), 0.0001f, "The Y of the vector is not correct here!");
            Assert.Less(Math.Abs(0.07f - result.Z), 0.0001f, "The Z of the vector is not correct here!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3DivisionByFloat END (OK)");
        }
Пример #16
0
        public void RelativeVector3Equals()
        {
            tlog.Debug(tag, $"RelativeVector3Equals START");

            var testingTarget = new RelativeVector3(0.02f, 0.02f, 0.02f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            using (RelativeVector3 vector = new RelativeVector3(0.02f, 0.02f, 0.02f))
            {
                var result = testingTarget.Equals(vector);
                Assert.IsTrue(result, "Should be true here!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3Equals END (OK)");
        }
Пример #17
0
        public void RelativeVector2ConstructorWithRelativeVector3()
        {
            tlog.Debug(tag, $"RelativeVector2ConstructorWithRelativeVector3 START");

            using (RelativeVector3 vec3 = new RelativeVector3(0.5f, 0.6f, 0.7f))
            {
                var testingTarget = new RelativeVector2(vec3);
                Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector2");
                Assert.IsInstanceOf <RelativeVector2>(testingTarget, "Should return RelativeVector2 instance.");

                Assert.AreEqual(0.5f, testingTarget.X, "Retrieved vector2.X should be equal to set value");
                Assert.AreEqual(0.6f, testingTarget.Y, "Retrieved vector2.Y should be equal to set value");

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"RelativeVector2ConstructorWithRelativeVector3 END (OK)");
        }
Пример #18
0
        public void RelativeVector3Dispose()
        {
            tlog.Debug(tag, $"RelativeVector3Dispose START");

            RelativeVector3 testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");
            try
            {
                testingTarget.Dispose();
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception" + e.ToString());
            }

            tlog.Debug(tag, $"RelativeVector3Dispose END (OK)");
        }
Пример #19
0
        public void RelativeVector3MultiplyByRelativeVector3()
        {
            tlog.Debug(tag, $"RelativeVector3MultiplyByRelativeVector3 START");

            var testingTarget = new RelativeVector3(0.5f, 0.6f, 0.7f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3");
            Assert.IsInstanceOf <RelativeVector3>(testingTarget, "Should be an instance of RelativeVector3 type.");

            using (RelativeVector3 vector = new RelativeVector3(0.4f, 0.3f, 0.2f))
            {
                var result = testingTarget * vector;
                Assert.Less(Math.Abs(0.2f - result.X), 0.0001f, "The X of the vector is not correct here!");
                Assert.Less(Math.Abs(0.18f - result.Y), 0.0001f, "The Y of the vector is not correct here!");
                Assert.Less(Math.Abs(0.14f - result.Z), 0.0001f, "The Z of the vector is not correct here!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector3MultiplyByRelativeVector3 END (OK)");
        }
Пример #20
0
        public void RelativeVector3TypeConverterConvertToString()
        {
            tlog.Debug(tag, $"RelativeVector3TypeConverterConvertToString START");

            var testingTarget = new RelativeVector3TypeConverterImpl();

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3TypeConverter.");
            Assert.IsInstanceOf <RelativeVector3TypeConverter>(testingTarget, "Should return RelativeVector3TypeConverter instance.");

            // null
            var result = testingTarget.ConvertToString(0.3f);

            tlog.Debug(tag, "ConvertToString : " + result);

            using (RelativeVector3 vec = new RelativeVector3(0.1f, 0.3f, 0.5f))
            {
                result = testingTarget.ConvertToString(vec);
                tlog.Debug(tag, "ConvertToString : " + result);
            }

            tlog.Debug(tag, $"RelativeVector3TypeConverterConvertToString END");
        }
Пример #21
0
        public override object ConvertFromInvariantString(string value)
        {
            if (value != null)
            {
                string[] parts = value.Split(TypeConverter.UnifiedDelimiter);
                if (parts.Length == 4)
                {
                    return(new RelativeVector4(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture)));
                }
                else if (parts.Length == 3)
                {
                    var vector3 = new RelativeVector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
                    var vector4 = new RelativeVector4(vector3);
                    vector3.Dispose();
                    return(vector4);
                }
                else if (parts.Length == 2)
                {
                    var vector2 = new RelativeVector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
                    var vector4 = new RelativeVector4(vector2);
                    vector2.Dispose();
                    return(vector4);
                }
                else if (parts.Length == 1)
                {
                    var x = Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture);
                    return(new RelativeVector4(x, x, x, x));
                }
            }

            throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector4)}");
        }
Пример #22
0
        public override string ConvertToString(object value)
        {
            RelativeVector3 vector = (RelativeVector3)value;

            return(vector.X.ToString() + " " + vector.Y.ToString() + " " + vector.Z.ToString());
        }