Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.BeginVertical(EditorStyles.helpBox);
            AntPoolList newPool = null;

            newPool = EditorGUILayout.ObjectField("Add Pool List", newPool, typeof(AntPoolList), true) as AntPoolList;
            if (newPool != null)
            {
                if (!AlreadyAdded(newPool))
                {
                    AntArray.Add <AntPoolList>(ref _self.pools, newPool);
                }
                else
                {
                    EditorUtility.DisplayDialog("Oops!", string.Format("Object `{0}` already added to the pool list!", newPool.name), "Ok");
                }
            }

            GUILayout.Space(3.0f);
            if (_self.pools.Length > 0)
            {
                EditorGUI.indentLevel++;
                int delIndex = -1;
                for (int i = 0, n = _self.pools.Length; i < n; i++)
                {
                    GUILayout.BeginHorizontal();

                    _self.pools[i] = EditorGUILayout.ObjectField(_self.pools[i], typeof(AntPoolList), true) as AntPoolList;

                    if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                    {
                        delIndex = i;
                    }

                    GUILayout.EndHorizontal();
                }

                if (delIndex > -1)
                {
                    AntArray.RemoveAt <AntPoolList>(ref _self.pools, delIndex);
                }
                EditorGUI.indentLevel--;
            }
            else
            {
                EditorGUILayout.LabelField("<Empty>", EditorStyles.centeredGreyMiniLabel);
            }
            GUILayout.Space(3.0f);
            GUILayout.EndVertical();

            _self.countPerStep = EditorGUILayout.IntField("Count Per Step", _self.countPerStep);
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            var prevKey = _self.key;

            _self.key = EditorGUILayout.TextField("Animation Key", _self.key);

            GUILayout.BeginVertical(EditorStyles.helpBox);
            {
                Sprite newSprite = null;
                newSprite = (Sprite)EditorGUILayout.ObjectField("Add Frame", newSprite, typeof(Sprite), false, GUILayout.MaxHeight(16.0f));
                if (newSprite != null)
                {
                    if (_self.frames == null)
                    {
                        _self.frames = new Sprite[0];
                    }

                    AntArray.Add <Sprite>(ref _self.frames, newSprite);
                }

                if (_self.frames != null)
                {
                    int    delIndex = -1;
                    Sprite prev;
                    for (int i = 0, n = _self.frames.Length; i < n; i++)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            prev            = _self.frames[i];
                            _self.frames[i] = (Sprite)EditorGUILayout.ObjectField(_self.frames[i], typeof(Sprite), false);
                            if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(20.0f), GUILayout.MaxHeight(20.0f)))
                            {
                                delIndex = i;
                            }
                        }
                        GUILayout.EndHorizontal();
                    }

                    if (delIndex > -1)
                    {
                        AntArray.RemoveAt <Sprite>(ref _self.frames, delIndex);
                    }
                }
            }
            GUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            EditorGUI.BeginChangeCheck();

            string[] anims = new string[_self.animations.Length];
            for (int i = 0, n = _self.animations.Length; i < n; i++)
            {
                anims[i] = (_self.animations[i] != null)
                                        ? _self.animations[i].key
                                        : "<Missed Animation>";
            }

            if (anims.Length == 0)
            {
                AntArray.Add(ref anims, "<None>");
            }

            int index = 0;

            index = System.Array.FindIndex(anims, x => string.Equals(x, _self.initialAnimation));
            index = (index < 0) ? 0 : index;
            index = EditorGUILayout.Popup("Initial Animation", index, anims);

            if (anims.Length > 0 && !_self.initialAnimation.Equals(anims[index]))
            {
                _self.initialAnimation = anims[index];
            }

            if (_self.animations.Length == 0)
            {
                EditorGUILayout.HelpBox("You must add at least one animation.", MessageType.Warning);
            }

            GUILayout.BeginVertical(EditorStyles.helpBox);
            {
                AntAnimation newAnim = null;
                newAnim = (AntAnimation)EditorGUILayout.ObjectField("Add Animation", newAnim, typeof(AntAnimation), false, GUILayout.MaxHeight(16.0f));
                if (newAnim != null)
                {
                    var foundIndex = System.Array.FindIndex(_self.animations, x => System.Object.ReferenceEquals(x, newAnim));
                    if (foundIndex == -1)
                    {
                        foundIndex = System.Array.FindIndex(_self.animations, x => x.key.Equals(newAnim.key));
                        if (foundIndex == -1)
                        {
                            AntArray.Add <AntAnimation>(ref _self.animations, newAnim);
                        }
                        else
                        {
                            A.Warning($"Animation with `{newAnim.key}` name already exists! Required unique animation names.");
                        }
                    }
                    else
                    {
                        A.Warning($"Animation `{newAnim.name}` already added!");
                    }
                }

                int          delIndex = -1;
                AntAnimation prevAnim = null;
                for (int i = 0, n = _self.animations.Length; i < n; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        prevAnim            = _self.animations[i];
                        _self.animations[i] = (AntAnimation)EditorGUILayout.ObjectField(_self.animations[i], typeof(AntAnimation), false);
                        if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(20.0f), GUILayout.MaxHeight(20.0f)))
                        {
                            delIndex = i;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                if (delIndex > -1)
                {
                    AntArray.RemoveAt <AntAnimation>(ref _self.animations, delIndex);
                }
            }
            GUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }
        }
        private void DrawPoolList()
        {
            GUILayout.BeginHorizontal();
            {
                _searchQuery = GUILayout.TextField(_searchQuery, GUI.skin.FindStyle("ToolbarSeachTextField") /*, GUILayout.MinWidth(150.0f)*/);
                if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton") /*, GUILayout.MaxWidth(150.0f)*/))
                {
                    _searchQuery = string.Empty;
                    GUI.FocusControl(null);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical();
            {
                GameObject newObject = null;
                newObject = (GameObject)EditorGUILayout.ObjectField("Drop to Add", newObject, typeof(GameObject), false);
                if (newObject != null)
                {
                    if (!AlreadyAdded(newObject))
                    {
                        AntArray.Add <AntPoolList.Item>(ref _self.items, new AntPoolList.Item
                        {
                            prefab      = newObject,
                            initialSize = 5,
                            isGrow      = true,
                            maxGrowing  = 20,
                            isOpened    = true
                        });
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("Oops!", string.Format("Object `{0}` already added to the pool list!", newObject.name), "Ok");
                    }
                }
            }
            GUILayout.EndVertical();

            if (_self.items.Length == 0)
            {
                EditorGUILayout.LabelField("The Pool List is Empty.");
            }
            else
            {
                GUILayout.BeginVertical();
                {
                    Color            c = GUI.color;
                    AntPoolList.Item curItem;
                    for (int i = _self.items.Length - 1; i >= 0; i--)
                    {
                        curItem = _self.items[i];
                        if (curItem.prefab == null || (curItem.prefab != null && curItem.prefab.name.ToLower().Contains(_searchQuery.ToLower())))
                        {
                            EditorGUI.indentLevel++;
                            if (curItem.prefab == null)
                            {
                                GUI.color = Color.red;
                            }
                            GUILayout.BeginVertical(EditorStyles.helpBox);
                            GUI.color = c;

                            GUILayout.BeginHorizontal();
                            {
                                curItem.isOpened = (curItem.prefab != null)
                                                                        ? EditorGUILayout.Foldout(curItem.isOpened, curItem.prefab.name, true)
                                                                        : curItem.isOpened = EditorGUILayout.Foldout(curItem.isOpened, "<Missed Prefab>", true);

                                EditorGUILayout.LabelField(string.Format("{0}", curItem.initialSize), GUILayout.MaxWidth(60.0f));

                                if (_removeIndex == i && !_confirmRemove)
                                {
                                    GUI.color      = Color.red;
                                    _confirmRemove = GUILayout.Button("Delete?", GUILayout.MaxWidth(70.0f), GUILayout.MaxHeight(16.0f));

                                    GUI.color = Color.green;
                                    if (GUILayout.Button("X", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                                    {
                                        _removeIndex = -1;
                                    }

                                    GUI.color = c;
                                }
                                else
                                {
                                    if (GUILayout.Button("X", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                                    {
                                        _removeIndex = i;
                                    }
                                }

                                GUI.color = c;
                            }
                            GUILayout.EndHorizontal();

                            if (curItem.isOpened)
                            {
                                GUILayout.Space(2.0f);
                                EditorGUI.indentLevel++;

                                curItem.prefab      = (GameObject)EditorGUILayout.ObjectField("Object Prefab", curItem.prefab, typeof(GameObject), false);
                                curItem.initialSize = EditorGUILayout.IntField("Initial Size", curItem.initialSize);

                                EditorGUI.indentLevel--;
                                GUILayout.Space(2.0f);
                            }

                            _self.items[i] = curItem;
                            EditorGUI.indentLevel--;
                            GUILayout.EndVertical();
                        }
                    }
                }
                GUILayout.EndVertical();

                EditorGUILayout.LabelField(string.Concat("Total Objects: ", _self.items.Length.ToString()));
            }

            if (_removeIndex != 1 && _confirmRemove)
            {
                AntArray.RemoveAt <AntPoolList.Item>(ref _self.items, _removeIndex);
                _confirmRemove = false;
                _removeIndex   = -1;
            }
        }
        private bool MergeEdgesIfNotCrossing(Vector2 aA, Vector2 aB, Vector2 aC, Vector2 aD, int aFrom, int aTo)
        {
            // Link two nodes only. (?)
            // if ((AntMath.Equal(aA, aC) && AntMath.Equal(aB, aD)) ||
            //  (AntMath.Equal(aA, aD) && AntMath.Equal(aB, aC)))
            // {
            //  AntLog.Trace("Merge two edges!");
            //  return true;
            // }

            // Create one new node.
            // --------------------
            var v = new Vector2[] { aA, aB, aC, aD };

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (i != j && AntMath.Equal(v[i], v[j]))
                    {
                        // Remove shared vertex.
                        AntArray.RemoveAt <Vector2>(ref v, i);

                        var edges = new int[3];
                        edges[0] = GetEdge(v[0], v[1]);
                        edges[1] = GetEdge(v[1], v[2]);
                        edges[2] = GetEdge(v[2], v[0]);

                        var node = AddNode(edges[0], edges[1], edges[2]);
                        LinkNodes(aFrom, node);
                        LinkNodes(node, aTo);

                        var center   = _self.GetNodeCenter(node);
                        var testNode = _self.FindNodeByPoint(center);
                        if (testNode != node)
                        {
                            // The triangle turned inside out, recreate.
                            RemoveNode(node);

                            edges[0] = GetEdge(v[0], v[2]);
                            edges[1] = GetEdge(v[2], v[1]);
                            edges[2] = GetEdge(v[1], v[0]);

                            node = AddNode(edges[0], edges[1], edges[2]);
                            LinkNodes(aFrom, node);
                            LinkNodes(node, aTo);

                            center   = _self.GetNodeCenter(node);
                            testNode = _self.FindNodeByPoint(center);
                            if (testNode != node)
                            {
                                // The triangle turned inside out, recreate.
                                RemoveNode(node);

                                edges[0] = GetEdge(v[1], v[2]);
                                edges[1] = GetEdge(v[2], v[0]);
                                edges[2] = GetEdge(v[0], v[1]);

                                node = AddNode(edges[0], edges[1], edges[2]);
                                LinkNodes(aFrom, node);
                                LinkNodes(node, aTo);

                                center   = _self.GetNodeCenter(node);
                                testNode = _self.FindNodeByPoint(center);
                                if (testNode != node)
                                {
                                    A.Warning("Wrong triangle! ({0})", node);
                                }
                            }
                        }

                        return(true);
                    }
                }
            }

            // Create two new nodes.
            // ---------------------
            if (!AntGeo.LinesCross(aA, aB, aC, aD))
            {
                var edges = new int[5];
                edges[0] = GetEdge(aA, aB);
                edges[1] = GetEdge(aB, aD);
                edges[2] = GetEdge(aD, aA);
                edges[3] = GetEdge(aA, aC);
                edges[4] = GetEdge(aC, aD);

                var nodeA = AddNode(edges[0], edges[1], edges[2]);
                var nodeB = AddNode(edges[3], edges[4], edges[2]);
                LinkNodes(aFrom, nodeA);
                LinkNodes(nodeA, nodeB);
                LinkNodes(nodeB, aTo);
                return(true);
            }

            return(false);
        }
Exemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            EditorGUI.BeginChangeCheck();
            _self.startDelay = EditorGUILayout.FloatField("Start Delay", _self.startDelay);

            GUI.enabled    = !_self.isLooping;
            _self.lifeTime = EditorGUILayout.FloatField("LifeTime", _self.lifeTime);
            GUI.enabled    = true;

            _self.isLooping          = EditorGUILayout.Toggle("Looping", _self.isLooping);
            _self.isAutoPlay         = EditorGUILayout.Toggle("Auto Play", _self.isAutoPlay);
            _self.isAutoReturnToPool = EditorGUILayout.Toggle("Auto Return To Pool", _self.isAutoReturnToPool);
            _self.isAutoRepeat       = EditorGUILayout.Toggle("Auto Repeat", _self.isAutoRepeat);
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                AntEmitterPreset newObject = null;
                newObject = EditorGUILayout.ObjectField("Drop to Add", newObject, typeof(AntEmitterPreset), false) as AntEmitterPreset;
                if (newObject != null)
                {
                    AntArray.Add <AntEmitterPreset>(ref _self.emitters, newObject);
                }

                int delIndex = -1;
                for (int i = 0, n = _self.emitters.Length; i < n; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        _self.emitters[i] = EditorGUILayout.ObjectField(_self.emitters[i], typeof(AntEmitterPreset), false) as AntEmitterPreset;
                        if (GUILayout.Button("x", GUILayout.Width(16.0f), GUILayout.Height(16.0f)))
                        {
                            delIndex = i;
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                if (delIndex >= 0)
                {
                    AntArray.RemoveAt <AntEmitterPreset>(ref _self.emitters, delIndex);
                }
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }

            // MARK: Эффекты больше нельзя стартануть напрямую, т.к. они теперь работают через системы.
            // if (Application.isPlaying)
            // {
            //  if (_self.IsPlaying && (_self.isLooping || _self.isAutoRepeat))
            //  {
            //      if (GUILayout.Button("Stop"))
            //      {
            //          _self.Stop();
            //      }
            //  }
            //  else
            //  {
            //      if (GUILayout.Button("Play"))
            //      {
            //          _self.Play();
            //      }
            //  }
            // }
        }
        private void DrawConditionList(string aLabel, ref AntAIScenarioItem[] aConditions, ConditionKind aConditionKind)
        {
            GUILayout.BeginVertical();
            {
                var c = GUI.color;
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField(aLabel, EditorStyles.boldLabel);
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("", "OL Plus"))
                    {
                        var menu = new GenericMenu();
                        for (int i = 0, n = _scenario.conditions.list.Length; i < n; i++)
                        {
                            switch (aConditionKind)
                            {
                            case ConditionKind.Pre:
                                menu.AddItem(new GUIContent(_scenario.conditions.list[i].name), false, OnAddPreCondition, _scenario.conditions.list[i].name);
                                break;

                            case ConditionKind.Post:
                                menu.AddItem(new GUIContent(_scenario.conditions.list[i].name), false, OnAddPostCondition, _scenario.conditions.list[i].name);
                                break;
                            }
                        }
                        menu.ShowAsContext();
                    }
                }
                GUILayout.EndHorizontal();

                if (aConditions.Length == 0)
                {
                    GUILayout.Label("<Empty>", EditorStyles.centeredGreyMiniLabel);
                }
                else
                {
                    int delIndex = -1;
                    for (int i = 0, n = aConditions.Length; i < n; i++)
                    {
#if UNITY_2019_3_OR_NEWER
                        GUILayout.BeginHorizontal();
#else
                        GUILayout.BeginHorizontal("Icon.ClipSelected");
#endif
                        {
                            GUILayout.Space(4.0f);
                            GUI.color = c * ((aConditions[i].value)
                                                                ? new Color(0.5f, 1.0f, 0.5f) // green
                                                                : new Color(1.0f, 0.5f, 0.5f) // red
                                             );

                            if (GUILayout.Button(AntAIWorkbench.BoolToStr(aConditions[i].value), _badgeStyle, GUILayout.MaxWidth(20.0f), GUILayout.MaxHeight(20.0f)))
                            {
                                aConditions[i].value = !aConditions[i].value;
                            }

#if UNITY_2019_3_OR_NEWER
                            GUILayout.Label(_scenario.conditions.GetName(aConditions[i].id), _labelStyle);
#else
                            GUILayout.Label(_scenario.conditions.GetName(aConditions[i].id));
#endif
                            GUI.color = c;
                            if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(18.0f)))
                            {
                                delIndex = i;
                            }
                        }
                        GUILayout.EndHorizontal();
                    }

                    if (delIndex > -1)
                    {
                        AntArray.RemoveAt(ref aConditions, delIndex);
                    }
                }
            }
            GUILayout.EndVertical();
        }
Exemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            EditorGUILayout.Separator();
            EditorGUI.BeginChangeCheck();
            GameObject newEffect = null;

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("List of Effects", EditorStyles.boldLabel);
                if (GUILayout.Button("Collapse", EditorStyles.miniButtonLeft))
                {
                    for (int i = 0, n = _self.effects.Length; i < n; i++)
                    {
                        _self.effects[i].isOpened = false;
                    }
                }

                if (GUILayout.Button("Expand", EditorStyles.miniButtonRight))
                {
                    for (int i = 0, n = _self.effects.Length; i < n; i++)
                    {
                        _self.effects[i].isOpened = true;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            newEffect = (GameObject)EditorGUILayout.ObjectField("Add Effect", newEffect, typeof(GameObject), false);
            if (newEffect != null)
            {
                if (newEffect.GetComponent <AntEffect>() == null)
                {
                    A.Warning("Can't add the effect! Object `{0}` doesn't have a AntEmitterEffect.", newEffect.name);
                }
                else
                {
                    AntArray.Add <AntEffectSpawner.Settings>(ref _self.effects, new AntEffectSpawner.Settings
                    {
                        name                    = newEffect.name,
                        prefab                  = newEffect,
                        kind                    = AntEffectSpawner.EKind.Basic,
                        isAutoPlay              = true,
                        isUpdatePosition        = false,
                        isInheritAngle          = false,
                        isDisableOnInpact       = false,
                        isPlaceToImpactPosition = false,
                        isUseImpactAngle        = false,
                        isImpactOnce            = false,
                        impactLayerMask         = new LayerMask(),
                        delay                   = 0.0f,
                        rndToDelay              = Vector2.zero,
                        lifeTime                = 1.0f,
                        rndToLifeTime           = Vector2.zero,
                        angle                   = 0.0f,
                        offset                  = Vector2.zero,
                        dotColor                = Color.white,
                        isOpened                = true
                    });
                }
            }

            if (_self.effects.Length > 0)
            {
                int   delIndex = -1;
                Color c        = GUI.color;
                AntEffectSpawner.Settings settings;
                for (int i = 0, n = _self.effects.Length; i < n; i++)
                {
                    settings  = _self.effects[i];
                    GUI.color = GUI.color * settings.dotColor;
                    GUILayout.BeginVertical(EditorStyles.helpBox);
                    GUI.color = c;

                    GUILayout.BeginHorizontal();
                    {
                        EditorGUI.indentLevel++;
                        settings.isOpened = EditorGUILayout.Foldout(settings.isOpened, settings.name, true);
                        EditorGUI.indentLevel--;

                        // GUI.color = c * new Color(1.0f, 1.0f, 0.5f);
                        if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(16.0f), GUILayout.MaxHeight(16.0f)))
                        {
                            delIndex = i;
                        }
                        // GUI.color = c;
                    }
                    GUILayout.EndHorizontal();

                    if (settings.isOpened)
                    {
                        EditorGUILayout.Space();
                        EditorGUI.indentLevel++;
                        EditorGUILayout.BeginHorizontal();
                        settings.name     = EditorGUILayout.TextField("Name", settings.name);
                        settings.dotColor = EditorGUILayout.ColorField(settings.dotColor, GUILayout.MaxWidth(80.0f));
                        EditorGUILayout.EndHorizontal();
                        settings.prefab = EditorGUILayout.ObjectField("Effect", settings.prefab, typeof(GameObject), true) as GameObject;
                        // settings.kind = (AntEffectSpawner.EKind) EditorGUILayout.EnumPopup("Kind", settings.kind);

                        string tooltip;
                        // if (settings.kind == AntEffectSpawner.EKind.Basic)
                        // {
                        tooltip             = "Проигрывать эффект при создании объекта.";
                        settings.isAutoPlay = EditorGUILayout.Toggle(new GUIContent("Auto Play", tooltip), settings.isAutoPlay);

                        tooltip = "Остановить эффект при столкновении текущего объекта с другим.";
                        settings.isDisableOnInpact = EditorGUILayout.Toggle(new GUIContent("Stop OnCollision", tooltip), settings.isDisableOnInpact);
                        EditorGUILayout.Space();

                        tooltip         = "Смещение источника эффекта относительно владельца.";
                        settings.offset = EditorGUILayout.Vector2Field(new GUIContent("Offset", tooltip), settings.offset);

                        tooltip        = "Угол источника эффекта относительно владельца.";
                        settings.angle = EditorGUILayout.Slider(new GUIContent("Angle", tooltip), settings.angle, -180.0f, 180.0f);
                        EditorGUILayout.Space();

                        tooltip = "Применить угол объекта для эффекта.";
                        settings.isInheritAngle = EditorGUILayout.Toggle(new GUIContent("Inherit Angle", tooltip), settings.isInheritAngle);

                        tooltip = "Применить позицию объекта для эффекта во время анимации.";
                        settings.isUpdatePosition = EditorGUILayout.Toggle(new GUIContent("Update Position", tooltip), settings.isUpdatePosition);
                        EditorGUILayout.Space();
                        // }
                        // else if (settings.kind == AntEffectSpawner.EKind.Physic)
                        // {
                        //  settings.impactLayerMask = AntLayerMask.LayerMaskField("Layer Mask", settings.impactLayerMask);

                        //  tooltip = "Эффект проиграется один раз только при первом столкновении.";
                        //  settings.isImpactOnce = EditorGUILayout.Toggle(new GUIContent("Play Once", tooltip), settings.isImpactOnce);

                        //  tooltip = "Установить эффект в точку столкновения.";
                        //  settings.isPlaceToImpactPosition = EditorGUILayout.Toggle(new GUIContent("Place to Impact Point", tooltip), settings.isPlaceToImpactPosition);

                        //  tooltip = "Применить угол объекта для эффекта.";
                        //  settings.isInheritAngle = EditorGUILayout.Toggle(new GUIContent("Inherit Angle", tooltip), settings.isInheritAngle);

                        //  tooltip = "Применить позицию объекта для эффекта во время анимации.";
                        //  settings.isUseImpactAngle = EditorGUILayout.Toggle(new GUIContent("Use Inpact Angle", tooltip), settings.isUseImpactAngle);

                        //  EditorGUILayout.Space();
                        // }
                        EditorGUI.indentLevel--;

                        GUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            settings.customDelay = EditorGUILayout.BeginToggleGroup("Custom Delay", settings.customDelay);
                            if (settings.customDelay)
                            {
                                EditorGUILayout.Space();
                                settings.delay      = EditorGUILayout.FloatField("Delay", settings.delay);
                                settings.rndToDelay = EditorGUILayout.Vector2Field("Rnd to Delay", settings.rndToDelay);
                                EditorGUILayout.Space();
                            }
                            EditorGUILayout.EndToggleGroup();
                        }
                        GUILayout.EndVertical();

                        GUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            settings.customLifeTime = EditorGUILayout.BeginToggleGroup("Custom Life Time", settings.customLifeTime);
                            if (settings.customLifeTime)
                            {
                                EditorGUILayout.Space();
                                settings.lifeTime      = EditorGUILayout.FloatField("Life Time", settings.lifeTime);
                                settings.rndToLifeTime = EditorGUILayout.Vector2Field("Rnd to Life Time", settings.rndToLifeTime);
                                EditorGUILayout.Space();
                            }
                            EditorGUILayout.EndToggleGroup();
                        }
                        GUILayout.EndVertical();
                    }

                    _self.effects[i] = settings;
                    if (Application.isPlaying)
                    {
                        if (GUILayout.Button("Play"))
                        {
                            _self.Play(settings.name);
                        }

                        // EditorGUILayout.LabelField("Debug Settings");
                        // EditorGUILayout.Toggle("Auto Spawn", false);
                        // EditorGUILayout.FloatField("Spawn Delay", _self.)
                    }

                    GUILayout.EndVertical();
                }

                if (delIndex > -1)
                {
                    AntArray.RemoveAt <AntEffectSpawner.Settings>(ref _self.effects, delIndex);
                }
            }
            else
            {
                EditorGUILayout.LabelField("List of Effects is Empty.", EditorStyles.centeredGreyMiniLabel);
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }
        }
        public override void Draw()
        {
            if (_scenario == null)
            {
                return;
            }

            rect.height = (_worldState.list.Length > 0)
                                ? LINE_HEIGHT * _worldState.list.Length
                                : LINE_HEIGHT;
            rect.height += 52.0f;
            GUI.Box(rect, "", currentStyle);

            // Title
            GUI.Label(new Rect(rect.x + 12.0f, rect.y + 12.0f, rect.y + 12.0f, rect.width - 24.0f), title, _titleStyle);

            content.x      = rect.x + 7.0f;
            content.y      = rect.y + 30.0f;
            content.width  = rect.width - 14.0f;
            content.height = rect.height - 50.0f;
            GUI.Box(content, "", _bodyStyle);

            var r = new Rect(rect.x + rect.width - 25.0f, rect.y + 11.0f, 20.0f, 44.0f);

            EditorGUI.BeginChangeCheck();
            GUILayout.BeginArea(r);
            if (GUILayout.Button("", "OL Plus", GUILayout.MaxWidth(16.0f), GUILayout.MaxHeight(16.0f)))
            {
                var menu = new GenericMenu();
                for (int i = 0, n = _scenario.conditions.list.Length; i < n; i++)
                {
                    menu.AddItem(new GUIContent(_scenario.conditions.list[i].name), false, AddConditionHandler, _scenario.conditions.list[i].name);
                }

                menu.AddSeparator("");
                menu.AddItem(new GUIContent("Add All"), false, AddAllConditionsHandler, "Add All");
                menu.ShowAsContext();
            }
            GUILayout.EndArea();

#if UNITY_2019_3_OR_NEWER
            content.y += 3.0f;
#else
            content.y += 1.0f;
#endif

            content.height = (_worldState.list.Length > 0)
                                ? LINE_HEIGHT * _worldState.list.Length
                                : LINE_HEIGHT;

            var c = GUI.color;
            GUILayout.BeginArea(content);
            {
                EditorGUIUtility.labelWidth = 80.0f;
                if (_worldState.list.Length > 0)
                {
                    int delIndex = -1;
                    GUILayout.BeginVertical();
                    {
                        for (int i = 0, n = _worldState.list.Length; i < n; i++)
                        {
#if UNITY_2019_3_OR_NEWER
                            GUILayout.BeginHorizontal();
#else
                            GUILayout.BeginHorizontal("Icon.ClipSelected");
#endif
                            {
                                GUILayout.Space(4.0f);
                                GUI.color = c * ((_worldState.list[i].value)
                                                                        ? new Color(0.5f, 1.0f, 0.5f) // Green
                                                                        : new Color(1.0f, 0.5f, 0.5f) // Red
                                                 );

                                if (GUILayout.Button(AntAIWorkbench.BoolToStr(_worldState.list[i].value), _badgeStyle, GUILayout.MaxWidth(20.0f), GUILayout.MaxHeight(20.0f)))
                                {
                                    _worldState.list[i].value = !_worldState.list[i].value;
                                }

#if UNITY_2019_3_OR_NEWER
                                GUILayout.Label(_scenario.conditions.GetName(_worldState.list[i].id), _labelStyle);
#else
                                GUILayout.Label(_scenario.conditions.GetName(_worldState.list[i].id));
#endif
                                GUI.color = c;
                                if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(18.0f)))
                                {
                                    delIndex = i;
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                    GUILayout.EndVertical();

                    if (delIndex > -1)
                    {
                        AntArray.RemoveAt(ref _worldState.list, delIndex);
                    }
                }
                else
                {
                    GUILayout.Label("<No Coditions>", EditorStyles.centeredGreyMiniLabel);
                }
            }
            GUILayout.EndArea();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(_scenario);
            }
        }