Exemplo n.º 1
0
 private static void AssertLeafSubString(Rope.Node node, string expectedRight)
 {
     if (node == null)
     {
         expectedRight.Should().Be("");
     }
     else
     {
         node.IsLeaf.Should().BeTrue();
         node.SubString.Length.Should().BeGreaterThan(0);
         node.SubString.Should().Be(expectedRight);
     }
 }
Exemplo n.º 2
0
 public override void Initialize()
 {
     if (this.RightPart && this.RightPart.GetComponent <Rope>())
     {
         Rope.Node node = this.m_nodes[this.m_nodes.Count - 1];
         node.gameObject.transform.position = this.RightPart.GetComponent <Rope>().FirstSegment.transform.position;
         this.CreateJoint(node.gameObject, this.RightPart.GetComponent <Rope>().FirstSegment.GetComponent <Rigidbody>());
     }
     base.contraption.ChangeOneShotPartAmount(BasePart.BaseType(this.m_partType), this.EffectDirection(), 1);
     if (this.m_gridVisualizationNode)
     {
         this.m_gridVisualizationNode.SetActive(false);
     }
 }
Exemplo n.º 3
0
        private static void AssertNode(string expected, Rope.Node result)
        {
            Console.WriteLine("{0} => {1}", expected, result == null ? "Null String" : result.ToInOrderString());
            Console.WriteLine(result == null ? "<null>" : result.ToTreeString());
            (result == null ? "" : result.ToInOrderString()).Should().Be(expected);

            if (result != null)
            {
                var expectedWeight = expected.Length;
                result.TotalWeight.Should().Be(expectedWeight);

                result.SearchWeight.Should().Be(result.Right == null ? expectedWeight : expectedWeight - result.Right.TotalWeight);
            }
        }