Esempio n. 1
0
    public static void TestVisibility()
    {
        Roga2dNode node1 = new Roga2dNode();
        Roga2dNode node2 = new Roga2dNode();

        node1.Hide();
        Tester.Match(node1.IsVisible, false);

        node1.AddChild(node2);
        Tester.Match(node2.IsVisible, false);

        node1.Hide();
        Tester.Match(node1.IsVisible, false);
        Tester.Match(node2.IsVisible, false);

        node1.Show();
        Tester.Match(node1.IsVisible, true);
        Tester.Match(node2.IsVisible, true);

        node1.Destroy();
        node2.Destroy();
    }
Esempio n. 2
0
    public void AddChild(Roga2dNode node)
    {
        if (node.Parent != null) {
            Debug.LogError("Node cannot have multiple parent");
        }

        this.children.Add(node);

        if (this.isHidden) {
            node.Hide();
        }
        Roga2dGameObjectState state = Roga2dUtils.stashState(node.Transform);
        node.Transform.parent = this.transform;
        node.Parent = this;
        Roga2dUtils.applyState(node.Transform, state);
        nodeCount += 1;
    }