Ejemplo n.º 1
0
        public virtual void UpdateInspector()
        {
            foreach (var element in selection)
            {
                switch (element)
                {
                case BaseNodeView nodeView:
                    EditorGUILayoutExtension.DrawFieldsInInspector(nodeView.title, nodeView.Model);
                    Selection.activeObject = ObjectInspector.Instance;
                    return;

                case BaseEdgeView edgeView:
                    EditorGUILayoutExtension.DrawFieldsInInspector(edgeView.title, edgeView.Model);
                    Selection.activeObject = ObjectInspector.Instance;
                    return;

                case GroupView groupView:
                    EditorGUILayoutExtension.DrawFieldsInInspector(groupView.title, groupView.Model);
                    Selection.activeObject = ObjectInspector.Instance;
                    return;

                default:
                    break;
                }
            }

            Selection.activeObject = null;
        }
Ejemplo n.º 2
0
        public void DrawToolbarGUI(Rect rect)
        {
            rect.height = toolbarHeight;
            GUILayout.BeginArea(rect, NodeEditorGUI.toolbar);
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("File", NodeEditorGUI.toolbarDropdown, GUILayout.Width(50)))
            {
                GenericMenu menu = new GenericMenu();
                NodeCanvasManager.FillCanvasTypeMenu(ref menu, NewNodeCanvas, "New Canvas/");
                menu.AddSeparator("");
                menu.AddItem(new GUIContent("Load Canvas"), false, LoadCanvas);
                menu.AddItem(new GUIContent("Reload Canvas"), false, ReloadCanvas);
                menu.AddSeparator("");
                menu.AddItem(new GUIContent("Save Canvas"), false, SaveCanvas);
                menu.AddItem(new GUIContent("Save Canvas As"), false, SaveCanvasAs);
                menu.ShowAsContext();
            }

            GUILayout.Space(10);
            GUILayout.FlexibleSpace();
            //重定向到数据资产按钮
            EditorGUILayoutExtension.LinkFileLabelField("Click To go to asset Path", this.canvasCache.openedCanvasPath);
            GUILayout.Label(this.canvasCache.typeData.DisplayString, NodeEditorGUI.toolbarLabel);

            NodeEditor.curNodeCanvas.DrawToolbar();

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
Ejemplo n.º 3
0
	public override void OnInspectorGUI()
	{
		TurretData script = target as TurretData;

		DrawDefaultInspector();

		EditorGUILayout.Space();
		EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
		script.rangeOfView = EditorGUILayout.Slider("Range Of View", script.rangeOfView, 0.1f, 100f);
		script.targetLayerMask = EditorGUILayoutExtension.MappedMaskField("Target Layer Mask", script.targetLayerMask, this.users);

		EditorGUILayout.Space();
		EditorGUILayout.LabelField("Aim", EditorStyles.boldLabel);
		script.aimOmega = EditorGUILayout.Slider("Aim Omega", script.aimOmega, 0.1f, 500f);
		script.aimDuration = EditorGUILayout.Slider("Aim Duration", script.aimDuration, 0f, 10f);
		script.aimTargetSmooth = EditorGUILayout.Slider("Aim Target Smooth", script.aimTargetSmooth, 0.001f, 10f);
		script.targetPrefab = EditorGUILayout.ObjectField("Target Prefab", script.targetPrefab, typeof(GameObject), false) as GameObject;

		EditorGUILayout.Space();
		EditorGUILayout.LabelField("Wander", EditorStyles.boldLabel);
		script.wanderOmega = EditorGUILayout.Slider("Wander Omega", script.wanderOmega, 0.1f, 500f);
		script.wanderRotationDurationInterval = EditorGUILayoutExtension.IntervalField("Rotation duration interval", script.wanderRotationDurationInterval, new float[2]{0f, 10f});
		script.wanderMaxPauseQuarter = EditorGUILayout.IntSlider("Maximum number of pause quarter", script.wanderMaxPauseQuarter, 1, 5);

		EditorGUILayout.Space();
		EditorGUILayout.LabelField("Shoot", EditorStyles.boldLabel);
		script.loadDuration = EditorGUILayout.Slider("Load Duration", script.loadDuration, 0f, 5f);
		script.shootDelay = EditorGUILayout.Slider("After shoot delay", script.shootDelay, 0f, 5f);
		script.lazerPrefab = EditorGUILayout.ObjectField("Lazer Prefab", script.lazerPrefab, typeof(GameObject), false) as GameObject;
		script.loadPrefab = EditorGUILayout.ObjectField("Load Prefab", script.loadPrefab, typeof(GameObject), false) as GameObject;
		script.shootPrefab = EditorGUILayout.ObjectField("Shoot Prefab", script.shootPrefab, typeof(GameObject), false) as GameObject;
		script.haloPrefab = EditorGUILayout.ObjectField("Halo Prefab", script.haloPrefab, typeof(GameObject), false) as GameObject;

		EditorUtilityExtension.SetDirtyOnGUIChange(script);
	}
Ejemplo n.º 4
0
        public override void OnGUI(GUIContent label)
        {
            base.OnGUI(label);
            ICZType c = Value as ICZType;

            c.SetValue(EditorGUILayoutExtension.DrawField(label, c.ValueType, c.GetValue()));
        }
        private void OnGUI()
        {
            EditorGUILayoutExtension.LinkFileLabelField("EditorGUILayoutExtension.cs", "Assets/Editor/Examples/Example_34_LinkField/EditorGUILayoutExtension.cs");
            EditorGUILayoutExtension.LinkUrlLabelField("UnityToolchainsTrick仓库", "https://github.com/XINCGer/UnityToolchainsTrick");

            GUIExtension.LinkFileLabelField(new Rect(200, 40, 120, 16), "EditorGUIExtension.cs", "Assets/Editor/Examples/Example_34_LinkField/EditorGUIExtension.cs");
            GUIExtension.LinkUrlLabelField(new Rect(200, 60, 150, 16), "UnityToolchainsTrick仓库", "https://github.com/XINCGer/UnityToolchainsTrick");
        }
        private void OnGUI()
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("objects"));

            UnityObject obj = EditorGUILayoutExtension.DragDropAreaSingle(GUILayout.Height(50));

            GUI.Box(GUILayoutUtility.GetLastRect(), "使用GUILayout方式绘制接收单个资源区域,无需指定Rect", "GroupBox");
            if (obj != null)
            {
                objects.Add(obj);
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            Rect r = GUILayoutUtility.GetRect(50, 50);

            GUI.Box(r, "使用GUI方式绘制接收单个资源区域,需指定Rect", "GroupBox");
            obj = EditorGUIExtension.DragDropAreaSingle(r);
            if (obj != null)
            {
                objects.Add(obj);
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            r = GUILayoutUtility.GetRect(50, 50);
            GUI.Box(r, "使用GUI方式绘制接收单个资源区域,需指定Rect,自定义高亮色", "GroupBox");
            obj = EditorGUIExtension.DragDropAreaSingle(r, Color.black);
            if (obj != null)
            {
                objects.Add(obj);
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            r = GUILayoutUtility.GetRect(50, 50);
            GUI.Box(r, "使用GUI方式绘制接收单个资源区域,需指定Rect,自定义鼠标指针", "GroupBox");
            obj = EditorGUIExtension.DragDropAreaSingle(r, DragAndDropVisualMode.Link);
            if (obj != null)
            {
                objects.Add(obj);
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            r = GUILayoutUtility.GetRect(50, 50);
            GUI.Box(r, "使用GUI方式绘制接收多个个资源区域,需指定Rect,自定义高亮色和鼠标指针", "GroupBox");
            UnityObject[] objs = EditorGUIExtension.DragDropAreaMulti(r, DragAndDropVisualMode.Link, new Color(0.3f, 0.58f, 0.7f, 0.3f));
            if (objs != null)
            {
                foreach (var item in objs)
                {
                    objects.Add(item);
                }
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }
        }
Ejemplo n.º 7
0
    void OnGUI()
    {
        EditorGUILayoutExtension.DrawFields(data);

        if (GUILayout.Button("绘制一个普通对象到Inspector"))
        {
            EditorGUILayoutExtension.DrawFieldsInInspector("Test", data);
        }
    }
Ejemplo n.º 8
0
    public override void OnInspectorGUI()
    {
        if (!_modules)
            _modules = target as Modules;

        GUILayout.Space(20f);

        GUILayout.BeginVertical();

        List<Module> toRemove = new List<Module>();

        foreach (Module m in _modules)
        {
            GUILayout.BeginHorizontal();

            GUILayout.Label(m.GetName());
            if (GUILayout.Button("Remove", GUILayout.MaxWidth(60)))
            {
                Undo.RecordObject(_modules, "Removed Module");
                toRemove.Add(m);
            }

            GUILayout.EndHorizontal();

            EditorGUILayoutExtension.HorizontalLine();
        }

        _modules.Remove(toRemove);

        GUILayout.EndVertical();

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Add"))
        {
            LoadModuleSelector();
        }

        GUILayout.Space(35f);

        if (GUILayout.Button("Clear"))
        {
            Undo.RecordObject(_modules, "Cleared modules");

            _modules.Clear();
        }

        GUILayout.EndHorizontal();
    }
Ejemplo n.º 9
0
        protected override void RegisterDrawers()
        {
            base.RegisterDrawers();

            RegisterDrawer("goals", property =>
            {
                if (EditorGUILayoutExtension.DrawFoldout(agent.GetHashCode(), EditorGUIExtension.GetGUIContent("Goals")))
                {
                    goalsReorderableList.DoLayoutList();
                }
            });
            RegisterDrawer("preState", property =>
            {
                if (EditorGUILayoutExtension.DrawFoldout(agent.GetHashCode(), EditorGUIExtension.GetGUIContent("PreStates")))
                {
                    preStateReorderableList.DoLayoutList();
                }
            });
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            if (Target is BaseGraphElement graphElement)
            {
                foreach (var property in graphElement.BindableProperties)
                {
                    if (IgnoreProperty.Contains(property.Key))
                    {
                        continue;
                    }

                    property.Value.ValueBoxed = EditorGUILayoutExtension.DrawField(property.Key, property.Value.ValueType, property.Value.ValueBoxed);
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
            }
        }
        public override void OnGUI(GUIContent label)
        {
            SharedVariable variable      = Value as SharedVariable;
            IVariableOwner variableOwner = variable.VariableOwner;

            if (variableOwner == null)
            {
                EditorGUILayout.HelpBox("没有VariableOwner", MessageType.Error); return;
            }
            //EditorGUILayout.HelpBox("ReferenceType:" + variable.GUID, MessageType.Info);
            //if (variableOwner.GetVariable(variable.GUID) == null)
            //    variableOwner.SetVariable(variable.Clone() as SharedVariable);
            EditorGUI.BeginChangeCheck();
            object value = EditorGUILayoutExtension.DrawField(label, variable.GetValueType(), variable.GetValue());

            if (EditorGUI.EndChangeCheck())
            {
                variable.SetValue(value);
                EditorUtility.SetDirty(variableOwner.Self());
            }
        }
Ejemplo n.º 12
0
    public override void OnInspectorGUI()
    {
        RabbitData script = target as RabbitData;

        base.OnInspectorGUI();

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
        script.speed           = EditorGUILayout.Slider("Walk Speed", script.speed, 0.1f, 20f);
        script.maxStepDistance = EditorGUILayout.IntSlider("Max Step Distance", script.maxStepDistance, 1, 6);
        script.rangeOfView     = EditorGUILayout.Slider("Range Of View", script.rangeOfView, 0f, 20f);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Jump", EditorStyles.boldLabel);
        script.jumpHeight             = EditorGUILayout.Slider("Jump Height", script.jumpHeight, 0.1f, 5f);
        script.afterJumpTempoInterval = EditorGUILayoutExtension.IntervalField("After Jump Delay", script.afterJumpTempoInterval, AFTER_JUMP_MAGNITUDE);

        EditorUtilityExtension.SetDirtyOnGUIChange(script);

        serializedObject.ApplyModifiedProperties();
    }
        // Token: 0x06000A26 RID: 2598 RVA: 0x00031018 File Offset: 0x0002F218
        public void Draw(bool drawCodeExample)
        {
            if (TrickOverViewPreview.exampleGroupStyle == null)
            {
                TrickOverViewPreview.exampleGroupStyle = new GUIStyle(GUIStyle.none)
                {
                    padding = new RectOffset(1, 1, 10, 0)
                };
            }
            if (TrickOverViewPreview.previewStyle == null)
            {
                TrickOverViewPreview.previewStyle = new GUIStyle(GUIStyle.none)
                {
                    padding = new RectOffset(0, 0, 0, 0)
                };
            }

            GUILayout.BeginVertical(TrickOverViewPreview.exampleGroupStyle, new GUILayoutOption[0]);
            GUILayout.Label("Preview:", SirenixGUIStyles.BoldTitle, new GUILayoutOption[0]);
            GUILayout.BeginVertical(TrickOverViewPreview.previewStyle, GUILayoutOptions.ExpandWidth(true));
            Rect rect = GUIHelper.GetCurrentLayoutRect().Expand(4f, 0f);

            SirenixEditorGUI.DrawSolidRect(rect, EditorGUIUtility.isProSkin ? TrickOverViewPreview.previewBackgroundColorDark : TrickOverViewPreview.previewBackgroundColorLight, true);
            SirenixEditorGUI.DrawBorders(rect, 1, true);
            GUILayout.Space(8f);

            m_DrawCallbaclAction.Invoke(rect);
            this.tree = (this.tree ?? PropertyTree.Create(m_Example));
            this.tree.Draw(false);

            GUILayout.Space(8f);
            GUILayout.EndVertical();
            if (drawCodeExample && m_Example.GetTrickOverViewInfo().Code != null)
            {
                GUILayout.Space(12f);
                GUILayout.Label("Code", SirenixGUIStyles.BoldTitle, new GUILayoutOption[0]);
                Rect rect2 = SirenixEditorGUI.BeginToolbarBox(new GUILayoutOption[0]);
                SirenixEditorGUI.DrawSolidRect(rect2.HorizontalPadding(1f), SyntaxHighlighter.BackgroundColor, true);
                SirenixEditorGUI.BeginToolbarBoxHeader(22f);
                if (SirenixEditorGUI.ToolbarButton(this.showRaw ? "Highlighted" : "Raw", false))
                {
                    this.showRaw = !this.showRaw;
                }
                GUILayout.FlexibleSpace();
                EditorGUILayoutExtension.LinkFileLabelField("点击此处定位到脚本目录", this.m_Example.GetTrickOverViewInfo().CodePath);
                GUILayout.FlexibleSpace();
                if (SirenixEditorGUI.ToolbarButton("Copy", false))
                {
                    Clipboard.Copy <string>(this.m_Example.GetTrickOverViewInfo().Code);
                }
                SirenixEditorGUI.EndToolbarBoxHeader();
                if (TrickOverViewPreview.codeTextStyle == null)
                {
                    TrickOverViewPreview.codeTextStyle = new GUIStyle(SirenixGUIStyles.MultiLineLabel);
                    TrickOverViewPreview.codeTextStyle.normal.textColor  = SyntaxHighlighter.TextColor;
                    TrickOverViewPreview.codeTextStyle.active.textColor  = SyntaxHighlighter.TextColor;
                    TrickOverViewPreview.codeTextStyle.focused.textColor = SyntaxHighlighter.TextColor;
                    TrickOverViewPreview.codeTextStyle.wordWrap          = false;
                }
                GUIContent content = GUIHelper.TempContent(this.showRaw ? this.m_Example.GetTrickOverViewInfo().Code.TrimEnd(new char[]
                {
                    '\n',
                    '\r'
                }) : this.highlightedCode);
                Vector2 vector = TrickOverViewPreview.codeTextStyle.CalcSize(content);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(-3f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUIHelper.PushEventType((Event.current.type == EventType.ScrollWheel) ? EventType.Used : Event.current.type);
                this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, true, false, GUI.skin.horizontalScrollbar, GUIStyle.none, new GUILayoutOption[]
                {
                    GUILayout.MinHeight(vector.y + 20f)
                });
                Rect rect3 = GUILayoutUtility.GetRect(vector.x + 50f, vector.y).AddXMin(4f).AddY(2f);
                if (this.showRaw)
                {
                    EditorGUI.SelectableLabel(rect3, this.m_Example.GetTrickOverViewInfo().Code, TrickOverViewPreview.codeTextStyle);
                    GUILayout.Space(-14f);
                }
                else
                {
                    GUI.Label(rect3, content, TrickOverViewPreview.codeTextStyle);
                }
                GUILayout.EndScrollView();
                GUIHelper.PopEventType();
                GUILayout.EndVertical();
                GUILayout.Space(-3f);
                GUILayout.EndHorizontal();
                GUILayout.Space(-3f);
                SirenixEditorGUI.EndToolbarBox();
            }
            GUILayout.EndVertical();
        }
Ejemplo n.º 14
0
        private void OnGUI()
        {
            numsScroll = EditorGUILayoutExtension.ScrollList(serializedObject.FindProperty("nums"), numsScroll, ref numsFoldout, 15);

            objectsScroll = EditorGUILayoutExtension.ScrollList(serializedObject.FindProperty("objects"), objectsScroll, ref objectsFoldout, 20);
        }
Ejemplo n.º 15
0
    public override void OnInspectorGUI()
    {
        this.script = target as PoolingData;

        DrawDefaultInspector();

        EditorGUILayout.Space();
        if (GUILayout.Button("ADD NEW POOL"))
        {
            script.AddAt(script.pools.Count);
        }

        if (GUILayout.Button("REMOVE ALL POOLS"))
        {
            script.pools.Clear();
        }

        Rect rect     = EditorGUILayout.GetControlRect(true, 0);
        Rect baserect = rect;

        EditorGUILayoutExtension.DragAndDropField(635, "", false, this.OnDrag, this.Rules);

        if (script.pools.Count == 0)
        {
            return;
        }

        baserect.y     += 9;
        baserect.width  = 50;
        baserect.height = 20;
        EditorGUI.LabelField(baserect, "Pool", EditorStyles.boldLabel);

        // Rect n = rect;
        // n.x += 30;
        // n.y += 450;
        // n.width = 200;
        // n.height = 20;
        // val = EditorGUI.FloatField(n, "Value", val);

        GUIStyle style   = new GUIStyle(EditorStyles.label);
        GUIStyle n_style = new GUIStyle(EditorStyles.miniLabel);

        n_style.fontSize = 8;
        style.richText   = true;

        PoolingData.Pool pool;

        baserect.y += 18;

        for (int i = 0; i < script.pools.Count; ++i)
        {
            pool = script.pools[i];

            baserect.x      = rect.x + -8;
            baserect.width  = rect.width + 7;
            baserect.height = 21;
            EditorGUI.DrawRect(baserect, grey);

            baserect.x     += 15;
            baserect.y     += 3;
            baserect.width  = 0;
            baserect.height = 15;
            pool.show       = EditorGUI.Foldout(baserect, pool.show, "");

            baserect.y     += -1;
            baserect.width  = 1000;
            baserect.height = 40;
            if (pool.prefab)
            {
                EditorGUI.LabelField(baserect, pool.prefab.name, style);

                baserect.x = EditorUtilityExtension.GetTextWidth(pool.prefab.name, EditorStyles.label) + 21;
                EditorGUI.LabelField(baserect, $"({pool.size})", n_style);
            }
            else
            {
                EditorGUI.LabelField(baserect, "<color=yellow>Empty</color>", style);
            }

            baserect.x      = rect.width + -7;
            baserect.y     += 1;
            baserect.width  = 20;
            baserect.height = 20;
            if (GUI.Button(baserect, this.plusTexture, GUIStyle.none))
            {
                script.AddAt(i + 1);
                return;
            }

            if (pool.show)
            {
                baserect.x      = rect.width + -24;
                baserect.width  = 16;
                baserect.height = 16;
                if (GUI.Button(baserect, this.trashTexture, GUIStyle.none))
                {
                    script.pools.RemoveAt(i);
                    return;
                }

                baserect.x      = rect.x + -8;
                baserect.y     += 18;
                baserect.width  = rect.width + 7;
                baserect.height = 46;
                EditorGUI.DrawRect(baserect, grey);

                baserect.x      += 3;
                baserect.width  += -6;
                baserect.height += -3;
                EditorGUI.DrawRect(baserect, dark);

                baserect.x                  += 1;
                baserect.y                  += 3;
                baserect.width               = rect.width + -2;
                baserect.height              = 17;
                EditorGUIUtility.labelWidth += -77;
                pool.prefab                  = EditorGUI.ObjectField(baserect, "Prefab", pool.prefab, typeof(GameObject), false) as GameObject;

                EditorGUIUtility.labelWidth += 1;
                baserect.y     += 20;
                baserect.width  = rect.width + -4;
                baserect.height = 17;
                pool.size       = EditorGUI.IntSlider(baserect, "Size", pool.size, 1, 1000);

                baserect.y += 5;

                EditorGUIUtility.labelWidth += 76;
            }

            baserect.y += 21;

            script.pools[i] = pool;
        }

        EditorUtilityExtension.SetDirtyOnGUIChange(script);
    }
Ejemplo n.º 16
0
    public override void OnInspectorGUI()
    {
        LazerData script = target as LazerData;

        DrawDefaultInspector();

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Mode", EditorStyles.boldLabel);
        script.mode = (LazerData.LazerMode)EditorGUILayout.EnumPopup("Lazer Mode", script.mode);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
        script.speed    = EditorGUILayout.Slider("Speed", script.speed, 0.1f, 100f);
        script.lifetime = EditorGUILayout.Slider("Lifetime", script.lifetime, 0.01f, 100f);
        script.flatten  = EditorGUILayout.Toggle("Flatten", script.flatten);
        script.bounce   = EditorGUILayout.Toggle("Bounce", script.bounce);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Layer Mask", EditorStyles.boldLabel);
        script.hitLayerMask = EditorGUILayoutExtension.MappedMaskField("Hit Layer Mask", script.hitLayerMask, this.users);
        if (script.bounce)
        {
            script.bounceLayerMask = EditorGUILayoutExtension.MappedMaskField("Bounce Layer Mask", script.bounceLayerMask, script.hitLayerMask);
        }

        if (script.bounce)
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Bounce", EditorStyles.boldLabel);
            script.maxBounceCount = EditorGUILayout.IntSlider("Max Bounce Count", script.maxBounceCount, 1, 200);

            script.lastBounceMode = (LastBounceMode)EditorGUILayout.EnumPopup("Last Bounce Mode", script.lastBounceMode);

            EditorGUI.indentLevel++;
            script.coneAngle = EditorGUILayout.Slider("Cone Angle", script.coneAngle, 0f, 45f);

            if (script.lastBounceMode == LastBounceMode.Curve || script.lastBounceMode == LastBounceMode.Random)
            {
                script.gravityForceMultiplier = EditorGUILayout.Slider("Gravity Force Multiplier", script.gravityForceMultiplier, 0f, 10f);
                script.forwardForceMultiplier = EditorGUILayout.Slider("Forward Force Multiplier", script.forwardForceMultiplier, 0f, 2f);

                script.forceDampling = EditorGUILayout.Slider("Force Dampling", script.forceDampling, 0f, 1f);
            }

            EditorGUI.indentLevel--;
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);
        script.lazerImpactPrefab  = EditorGUILayout.ObjectField("Lazer Impact Prefab", script.lazerImpactPrefab, typeof(GameObject), false) as GameObject;
        script.groundImpactPrefab = EditorGUILayout.ObjectField("Ground Impact Prefab", script.groundImpactPrefab, typeof(GameObject), false) as GameObject;


        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Width", EditorStyles.boldLabel);
        script.width      = EditorGUILayout.Slider("Width", script.width, 0.01f, 10f);
        script.widthSpeed = EditorGUILayout.Slider("Width Decrease Speed", script.widthSpeed, 0.01f, 10f);

        if (script.mode == LazerData.LazerMode.Shot)
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Length", EditorStyles.boldLabel);
            script.length = EditorGUILayout.Slider("Length", script.length, 0.1f, 20f);
            // script.tailWidthPointLength = EditorGUILayout.Slider("Tail Width Point Length", script.tailWidthPointLength, 0f, script.length - 0.1f);

            // if(script.tailWidthPointLength > 0f) {
            //  script.tailWidthPointSpacing = EditorGUILayout.Slider("Tail Width Point Spacing", script.tailWidthPointSpacing, 0f, script.tailWidthPointLength);
            // }
        }
        else
        {
            script.widthPointSpeed = EditorGUILayout.Slider("Width Point Decrease Speed", script.widthPointSpeed, 0.01f, 10f);

            temp = script.distancePerPointMinMax;
            temp = EditorGUILayout.Vector2Field("Distance Per Point Interval", temp);
            script.distancePerPointMinMax.Set(Mathf.RoundToInt(Mathf.Min(Mathf.Max(temp.x, 0f), temp.y)), Mathf.RoundToInt(Mathf.Max(temp.x, Mathf.Min(temp.y, 10f))));
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Auto Aim", EditorStyles.boldLabel);
        script.autoAim = EditorGUILayout.Toggle("Auto Aim", script.autoAim);
        if (script.autoAim)
        {
            script.autoAimRange     = EditorGUILayout.Slider("Target Detection Radius", script.autoAimRange, 0f, 50f);
            script.autoAimThreshold = EditorGUILayout.Slider("Target Alignment Threshold", script.autoAimThreshold, 0f, 1f);
            script.autoAimLayerMask = EditorGUILayoutExtension.MappedMaskField("Target Layer Mask", script.autoAimLayerMask, script.hitLayerMask);
        }

        EditorUtilityExtension.SetDirtyOnGUIChange(script);
    }
Ejemplo n.º 17
0
 void OnGUI()
 {
     EditorGUILayoutExtension.DrawFields(data);
 }