示例#1
0
        public override void OnInspectorGUI()
        {
            AudioPropagateNodeGroup pGroup = (AudioPropagateNodeGroup)target;

            PropagateLogoGUI.DrawLogo();

            pGroup.maxConnectDistance = EditorGUILayout.FloatField("Max Connect Distance", pGroup.maxConnectDistance);

            if (GUILayout.Button("Add Node"))
            {
                var     view     = SceneView.currentDrawingSceneView;
                Vector3 position = pGroup.transform.position;
                if (selectedNode != null)
                {
                    position = selectedNode.position;
                }
                if (view != null)
                {
                    Transform  camT = view.camera.transform;
                    RaycastHit hit;
                    if (Physics.Raycast(camT.position, camT.forward, out hit, Mathf.Infinity))
                    {
                        position = hit.point + (hit.normal * 5f);
                    }
                    else
                    {
                        position = camT.position + (camT.forward * 5.0f);
                    }
                }
                selectedNode = pGroup.AddNode(position);
                SceneView.RepaintAll();
            }
            if (GUILayout.Button("Delete Node") && selectedNode != null)
            {
                pGroup.DeleteNode(selectedNode);
                selectedNode = null;
                SceneView.RepaintAll();
            }

            if (selectedNode != null)
            {
                string buttonText = isLinking ? "Cancel Link Node" : "Link Node";
                if (GUILayout.Button(buttonText))
                {
                    isLinking = !isLinking;
                }
            }
            else
            {
                isLinking = false;
            }
        }
示例#2
0
 public override void OnInspectorGUI()
 {
     PropagateLogoGUI.DrawLogo();
     base.OnInspectorGUI();
 }