Exemplo n.º 1
0
            private void updateTop(NodeBehaviour node)
            {
                var w = node.transform;

                w.localRotation = Quaternion.identity;
                var startScale = w.localScale;
                var holeTop    = this.position.y + this.scale.y / 2;
                var hs         = w.localScale.y / 2;

                var s2 = hs - holeTop;
                var p2 = (hs + holeTop) / 2;

                w.localPosition = new Vector3(0, p2, 0);
                w.localScale   += new Vector3(0, s2 - hs * 2, 0);

                w.localPosition = NodeHelper.InverseScale(w.localPosition, startScale);
                w.localScale    = NodeHelper.InverseScale(w.localScale, startScale);

                if (Mathf.Abs(s2) < SMALLEST_WALL)
                {
                    this.deleteNode(node);
                }
            }
Exemplo n.º 2
0
            private void updateLeft(NodeBehaviour node)
            {
                var w = node.transform;

                w.localRotation = Quaternion.identity;
                var startScale = w.localScale;
                var holeLeft   = this.position.x - this.scale.x / 2;
                var hs         = w.localScale.x / 2;

                var s2 = hs + holeLeft;
                var p2 = (-hs + holeLeft) / 2;

                w.localPosition = new Vector3(p2, this.position.y, 0);
                w.localScale   += new Vector3(s2 - hs * 2, this.scale.y - w.localScale.y, 0);

                w.localPosition = NodeHelper.InverseScale(w.localPosition, startScale);
                w.localScale    = NodeHelper.InverseScale(w.localScale, startScale);

                if (Mathf.Abs(s2) < SMALLEST_WALL)
                {
                    this.deleteNode(node);
                }
            }
Exemplo n.º 3
0
        private void loadedGUI()
        {
            if (GUILayout.Button("unload"))
            {
                this.UnLoad();
                return;
            }
            if (GUILayout.Button("Save" + (NodeDataManager.NeedSave || this.sceneChanged ? " *" : "")))
            {
                this.Save();
            }
            if (GUILayout.Button("load (Overwrite Scene)"))
            {
                this.Load();
            }

            GUIHelper.HorizontalLine();
            if (GUILayout.Button("Normalise direct children"))
            {
                var node = this.activeNodeBehavior();
                NodeHelper.NormaliseScale(node);
            }
            if (GUILayout.Button("New Node"))
            {
                NodeCreatorWindow.ShowWindow();
            }
            if (GUILayout.Button("Cut Hole"))
            {
                HoleCutterWindow.ShowWindow();
            }
            GUIHelper.HorizontalLine();
            if (GUILayout.Button("Close And Clean Scene"))
            {
                this.finishNodeEditing();
            }
        }
Exemplo n.º 4
0
        public void UpdateFromJson(NodeJson updatedJson)
        {
            if (updatedJson == null)
            {
                return;
            }

            this.name = updatedJson.name;
            this.transform.localPosition = updatedJson.position;
            if (this.GetScale() != updatedJson.scale)
            {
                var newScale = NodeHelper.InverseScale(updatedJson.scale, this.GetScale());
                this.transform.localScale = newScale;
                NodeHelper.NormaliseScale(this);
            }

            var parentName = this.HasParent ? this.parent.name : "";

            if (updatedJson.parentName != parentName)
            {
                var newParent = updatedJson.parentName == "" ? RootParent : NodeDataManager.FindNode(updatedJson.parentName);
                this.ChangeParent(newParent);
            }
        }
Exemplo n.º 5
0
            private NodeBehaviour createQuad(string nameDirection, Vector3 pos, Vector3 sca, Quaternion rot, NodeBehaviour parent)
            {
                var creator = new QuadCreator(string.Format("{0} {1}", this.name, nameDirection), NodeHelper.Scale(pos, this.scale / 2), sca)
                {
                    rotation = rot
                };
                var node = creator.Create();

                node.SetParent(parent);
                node.noJson = true;
                return(node);
            }