Exemplo n.º 1
0
        public void TestParseAttachNode()
        {
            AttachNode node = AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6, 6.7");

            AssertParsedAttachNode(node, new Vector3(1.2f, 2.3f, 3.4f), new Vector3(4.5f, 5.6f, 6.7f));
            Assert.Equal(1, node.size);
        }
Exemplo n.º 2
0
        public void TestParseAttachNode__AttachNodeMethod()
        {
            AttachNode node = AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 1, 0");

            AssertParsedAttachNode(node, new Vector3(1.2f, 2.3f, 3.4f), new Vector3(4.5f, 5.6f, 6.7f));
            Assert.Equal(1, node.size);
            Assert.Equal(AttachNodeMethod.FIXED_JOINT, node.attachMethod);

            AttachNode node2 = AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 1, 1");

            AssertParsedAttachNode(node2, new Vector3(1.2f, 2.3f, 3.4f), new Vector3(4.5f, 5.6f, 6.7f));
            Assert.Equal(1, node2.size);
            Assert.Equal(AttachNodeMethod.HINGE_JOINT, node2.attachMethod);
        }
Exemplo n.º 3
0
        public void TestParseAttachNode__Rigid()
        {
            AttachNode node = AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 1, 0, 0, 0");

            AssertParsedAttachNode(node, new Vector3(1.2f, 2.3f, 3.4f), new Vector3(4.5f, 5.6f, 6.7f));
            Assert.Equal(1, node.size);
            Assert.Equal(AttachNodeMethod.FIXED_JOINT, node.attachMethod);
            Assert.False(node.ResourceXFeed);
            Assert.False(node.rigid);

            AttachNode node2 = AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 1, 0, 0, 1");

            AssertParsedAttachNode(node2, new Vector3(1.2f, 2.3f, 3.4f), new Vector3(4.5f, 5.6f, 6.7f));
            Assert.Equal(1, node2.size);
            Assert.Equal(AttachNodeMethod.FIXED_JOINT, node2.attachMethod);
            Assert.False(node2.ResourceXFeed);
            Assert.True(node2.rigid);
        }
Exemplo n.º 4
0
        public void TestFormatAttachNode()
        {
            Vector3    position    = new Vector3(1.2f, 2.3f, 3.4f);
            Vector3    orientation = new Vector3(4.5f, 5.6f, 6.7f);
            AttachNode node        = new AttachNode
            {
                position      = position,
                orientation   = orientation,
                size          = 4,
                attachMethod  = AttachNodeMethod.NONE,
                ResourceXFeed = true,
                rigid         = false,
            };

            string expectedStr = "1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 4, 5, 1, 0";

            Assert.Equal(expectedStr, AttachNodeValueParser.FormatAttachNode(node));
        }
Exemplo n.º 5
0
 public void TestParseAttachNode__Null()
 {
     Assert.Throws <ArgumentNullException>(() => AttachNodeValueParser.ParseAttachNode(null));
 }
Exemplo n.º 6
0
 public void TestParseAttachNode__TooFewValues()
 {
     Assert.Throws <FormatException>(() => AttachNodeValueParser.ParseAttachNode("1.2, 2.3, 3.4, 4.5, 5.6"));
 }