コード例 #1
0
        private static void DrawReferenceGroupList(ICECreatureRegister _register, List <ReferenceGroupObject> _list)
        {
            for (int _index = 0; _index < _list.Count; _index++)
            {
                ReferenceGroupObject _group = _list[_index];

                UpdateStatus(_group);

                if (_group != null && _group.ReferenceGameObject != null)
                {
                    ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);
                    ICEEditorLayout.BeginHorizontal();
                    EditorGUI.BeginDisabledGroup(_group.Enabled == false);
                    _group.Foldout = EditorGUILayout.Foldout(_group.Foldout, GetTitleText(_group), ICEEditorStyle.Foldout);
                    GUILayout.FlexibleSpace();

                    DrawEntityType(_group);

                    EditorGUI.EndDisabledGroup();


                    if (ICEEditorLayout.ListUpDownButtons <ReferenceGroupObject>(_list, _index))
                    {
                        return;
                    }

                    GUILayout.Space(5);
                    EditorGUI.BeginDisabledGroup(_group.Enabled == false);

                    EditorGUI.BeginDisabledGroup(_group.EntityComponent == null);
                    _group.Break = ICEEditorLayout.CheckButtonMiddle("BREAK", "Deactivates all entity components", _group.Break);
                    EditorGUI.EndDisabledGroup();

                    _group.UseSoftRespawn = ICEEditorLayout.CheckButtonMiddle("RECYCLE", "Allows the reuse of suspended objects without new instantiations", _group.UseSoftRespawn);

                    EditorGUI.BeginDisabledGroup(_register.UsePoolManagement == false);
                    _group.PoolManagementEnabled = ICEEditorLayout.CheckButtonMiddle("POOL", "Activates Pool Management", _group.PoolManagementEnabled);
                    EditorGUI.EndDisabledGroup();
                    EditorGUI.EndDisabledGroup();

                    _group.Enabled = ICEEditorLayout.EnableButton("Enables/Disables the group", _group.Enabled);

                    if (ICEEditorLayout.ListDeleteButtonMini <ReferenceGroupObject>(_list, _group, "Removes this reference group."))
                    {
                        return;
                    }

                    ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_GROUP);

                    DrawReferenceGroup(_register, _group);
                }
                else
                {
                    _list.RemoveAt(_index);
                    --_index;
                }
            }
        }
コード例 #2
0
        public void Init(GameObject gameObject)
        {
            m_Owner = gameObject;

            if (m_CreatureRegister == null)
            {
                m_CreatureRegister = GameObject.FindObjectOfType <ICECreatureRegister>();
            }
        }
コード例 #3
0
        /// <summary>
        /// Zones popup.
        /// </summary>
        /// <returns>Zones popup.</returns>
        /// <param name="_title">Title.</param>
        /// <param name="_hint">Hint.</param>
        /// <param name="_key">Key.</param>
        /// <param name="_help">Help.</param>
        public static string ZonePopup(string _title, string _hint, string _key, string _help = "")
        {
            ICECreatureRegister _register = ICECreatureRegister.Instance;
            List <string>       _list     = null;

            if (_register != null)
            {
                _list = _register.ReferenceZoneNames;
            }

            return(ReferencePopup(_title, _hint, _key, _list, _help));
        }
コード例 #4
0
        public static string RegisterPopup(string _title, string _group, string _help = "")
        {
            ICECreatureRegister _register = ICECreatureRegister.Register;            // GameObject.FindObjectOfType<ICECreatureRegister>();

            if (_register == null)
            {
                EditorGUILayout.LabelField(_title);
                return(null);
            }
            else if (_register.ReferenceCreatures.Count == 0)
            {
                EditorGUILayout.LabelField(_title);
                return(null);
            }
            else
            {
                List <CreatureReferenceObject> _creatures = _register.ReferenceCreatures;

                string[] _names = new string[_creatures.Count];

                int _index = 0;
                for (int i = 0; i < _creatures.Count; i++)
                {
                    _names[i] = _creatures[i].Name;

                    if (_group == _names[i])
                    {
                        _index = i;
                    }
                }

                if (_creatures[_index] != null && _creatures[_index].Status.isPrefab)
                {
                    _title += " (prefab)";
                }
                else
                {
                    _title += " (scene)";
                }

                _index = ICEEditorLayout.Popup(_title, "", _index, _names, _help);

                return(_names[_index]);
            }
        }
コード例 #5
0
        public static void Print(ICECreatureRegister _register)
        {
            EditorGUILayout.Separator();

            m_foldout = ICEEditorLayout.Foldout(m_foldout, "Options", Info.REGISTER_OPTIONS);
            if (!m_foldout)
            {
                return;
            }

            EditorGUILayout.Separator();
            EditorGUI.indentLevel++;

            _register.Options.Enabled = true;
            CreatureObjectEditor.DrawRegisterDefaultSettings(_register, _register.Options, EditorHeaderType.FOLDOUT_BOLD);
            CreatureObjectEditor.DrawHierarchyManagementObject(_register, _register.HierarchyManagement, EditorHeaderType.FOLDOUT_ENABLED_BOLD);
            CreatureObjectEditor.DrawRegisterDebugObject(_register, _register.RegisterDebug, EditorHeaderType.FOLDOUT_ENABLED_BOLD);

            EditorGUILayout.Separator();
            _register.UseDontDestroyOnLoad       = ICEEditorLayout.Toggle("Don't Destroy On Load", "", _register.UseDontDestroyOnLoad, Info.REGISTER_OPTIONS_DONTDESTROYONLOAD);
            _register.UsePoolManagementCoroutine = ICEEditorLayout.Toggle("Use Pool Management Coroutine", "Use coroutine for pool management", _register.UsePoolManagementCoroutine, Info.REGISTER_OPTIONS_POOL_MANAGEMENT_COROUTINE);
            _register.UseGarbageCollection       = ICEEditorLayout.Toggle("Custom Garbage Collection", "", _register.UseGarbageCollection, Info.REGISTER_OPTIONS_CUSTOM_GARBAGE_COLLECTION);
            if (_register.UseGarbageCollection)
            {
                EditorGUI.indentLevel++;
                _register.GarbageCollectionInterval = ICEEditorLayout.DefaultSlider("Interval", "", _register.GarbageCollectionInterval, Init.DECIMAL_PRECISION_TIMER, 0, 10, 3, "");
                EditorGUI.indentLevel--;
            }

            _register.RandomSeed = (RandomSeedType)ICEEditorLayout.EnumPopup("Random Seed", "Sets the seed for the random number generator.", _register.RandomSeed, Info.REGISTER_OPTIONS_RANDOMSEED);
            if (_register.RandomSeed == RandomSeedType.CUSTOM)
            {
                EditorGUI.indentLevel++;
                _register.CustomRandomSeed = ICEEditorLayout.IntField("Seed Value", "Custom RandomSeed Integer Value", _register.CustomRandomSeed, Info.REGISTER_OPTIONS_RANDOMSEED_CUSTOM);
                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();
            }

            EditorGUI.indentLevel--;
            EditorGUILayout.Separator();
            ICEEditorStyle.SplitterByIndent(0);
        }
コード例 #6
0
        void Awake()
        {
            m_Register = ICECreatureRegister.Instance;

            if (m_Register == null)
            {
                return;
            }

            m_Register.NetworkAdapter = NetworkAdapterType.PUN;

            m_Register.OnDestroyObject += OnDestroyObject;
            m_Register.OnSpawnObject   += OnSpawnObject;


            // deactivates the pool management if it is not the master
            if (PhotonNetwork.isMasterClient == false)
            {
                //m_Register.UsePoolManagement = false;
            }
        }
コード例 #7
0
        private static GameObject DrawRegisterPopup(string _title)
        {
            if (m_creature_register == null)
            {
                m_creature_register = GameObject.FindObjectOfType <ICECreatureRegister>();
            }

            if (m_creature_register == null)
            {
                EditorGUILayout.LabelField(_title);
                return(null);
            }
            else if (m_creature_register.ReferenceCreatures.Count == 0)
            {
                EditorGUILayout.LabelField(_title);
                return(null);
            }
            else
            {
                List <CreatureReferenceObject> _creatures = m_creature_register.ReferenceCreatures;

                string[] _names = new string[_creatures.Count];

                if (_register_popup_index > _creatures.Count)
                {
                    _register_popup_index = 0;
                }

                for (int i = 0; i < _creatures.Count; i++)
                {
                    _names[i] = _creatures[i].Name;
                }

                _register_popup_index = EditorGUILayout.Popup(_title, _register_popup_index, _names);

                return(_creatures[_register_popup_index].Creature);
            }
        }
コード例 #8
0
ファイル: ICE_UC_Integration.cs プロジェクト: milkcorp/wiener
        public void TriggerBuildingsAvoidanceOnScene()
        {
#if uConstruct_ICEExtension
            ICECreatureRegister register = GameObject.FindObjectOfType <ICECreatureRegister>();

            if (register == null)
            {
                Debug.LogError("ICECreatureRegister can not be found!");
                return;
            }

            if (!register.ObstacleLayers.Contains(LayersData.BuildingLayers[LayersData.instance.defaultBuildingLayer]))
            {
                register.ObstacleLayers.Add(LayersData.BuildingLayers[LayersData.instance.defaultBuildingLayer]);
                Debug.Log("Added default building layer to obstacles");
            }
            else
            {
                register.ObstacleLayers.Remove(LayersData.BuildingLayers[LayersData.instance.defaultBuildingLayer]);
                Debug.Log("Removed default building layer from obstacles");
            }
#endif
        }
コード例 #9
0
        /// <summary>
        /// Draws the register popup.
        /// </summary>
        /// <returns>The register popup.</returns>
        /// <param name="_title">Title.</param>
        /// <param name="_index">Index.</param>
        public static int QuickSelectionPopup(string _title, int _index = 0)
        {
            ICECreatureRegister _register = ICECreatureRegister.Instance;

            if (_register == null)
            {
                EditorGUILayout.LabelField(_title);
                return(0);
            }
            else if (_register.ReferenceGroupObjects.Count == 0)
            {
                EditorGUILayout.LabelField(_title);
                return(0);
            }
            else
            {
                List <ReferenceGroupObject> _groups = _register.ReferenceGroupObjects;

                string[] _names = new string[_groups.Count];

                if (_index > _groups.Count)
                {
                    _index = 0;
                }

                for (int i = 0; i < _groups.Count; i++)
                {
                    _names[i] = _groups[i].Name;
                }

                GUI.backgroundColor = ICEEditorLayout.DebugButtonColor;
                _index = EditorGUILayout.Popup(_title, _index, _names);
                GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor;
                return(_index);
            }
        }
コード例 #10
0
 static bool ValidateAddCreatureRegister()
 {
     return(!ICECreatureRegister.Exists());
 }
コード例 #11
0
 static void AddCreatureRegister()
 {
     ICECreatureRegister.Create();
 }
コード例 #12
0
        public static void QuickSelectionPopup(string _title, ICECreatureEntity _entity)
        {
            ICECreatureRegister _register = ICECreatureRegister.Instance;

            if (_register == null)
            {
            }
            else
            {
                ICEEditorLayout.BeginHorizontal();

                int _new_index = Popups.QuickSelectionPopup(_title, QuickSelectIndex);

                if (_register.ReferenceGroupObjects.Count > 0)
                {
                    int _own_index = CreatureRegister.GetReferenceIndexByName(_entity.name);
                    if (_new_index != _own_index)
                    {
                        QuickSelectIndex = _new_index;
                        QuickSelectGroup = _register.ReferenceGroupObjects[QuickSelectIndex];
                    }

                    if (ICEEditorLayout.DebugButton("SELECT", "Activates the displayed GameObject. You can use this funtion to switch between your objects.") && _new_index < _register.ReferenceGroupObjects.Count)
                    {
                        if (_entity != null)
                        {
                            QuickSelectIndex = CreatureRegister.GetReferenceIndexByName(_entity.name);
                        }

                        Selection.activeGameObject = _register.ReferenceGroupObjects[_new_index].ReferenceGameObject;
                    }
                }
                else
                {
                    if (ICEEditorLayout.DebugButton("UPDATE", "Updates the register by scanning the scene for relevant objects"))
                    {
                        _register.UpdateReferences();
                    }
                }

                if (ICEEditorLayout.DebugButton("REGISTER", "Switches the focus to the Creature Register"))
                {
                    Selection.activeGameObject = _register.gameObject;
                }

                if (QuickSelectGroup == null || QuickSelectGroup.EntityType != _entity.EntityType)
                {
                    EditorGUI.BeginDisabledGroup(true);
                    ICEEditorLayout.DebugButton("COPY", "Copys the settings from the selected entity to this one. Both entities must be from the same type!");
                    EditorGUI.EndDisabledGroup();
                }
                else
                {
                    if (ICEEditorLayout.DebugButton("COPY", "Copies the settings from the selected entity to this one. Both entities must be from the same type!"))
                    {
                        string _warning = "Please note, this function copies the settings from the selected entity (" + QuickSelectGroup.Name + ") to this one (" + _entity.name + "). This overwrites all settings " +
                                          "of this entity. Are you sure you want to do that? \n\n" +
                                          "Press COPY to continue or CANCEL to abort.";

                        if (EditorUtility.DisplayDialog("Copy Message", _warning, "COPY", "CANCEL"))
                        {
                            UnityEditorInternal.ComponentUtility.CopyComponent(QuickSelectGroup.EntityComponent);
                            UnityEditorInternal.ComponentUtility.PasteComponentValues(_entity);
                        }
                    }
                }

                ICEEditorLayout.EndHorizontal(Info.ENTITY_QUICK_SELECTION);
            }
        }
コード例 #13
0
        public static void Print(ICECreatureControl _control)
        {
            if (m_creature_register == null)
            {
                m_creature_register = ICECreatureRegister.Register;
            }

            if (m_creature_register == null)
            {
                return;
            }

            if (!_control.Display.ShowInteractionSettings)
            {
                return;
            }

            ICEEditorStyle.SplitterByIndent(0);
            ICEEditorLayout.BeginHorizontal();
            _control.Display.FoldoutInteraction = ICEEditorLayout.Foldout(_control.Display.FoldoutInteraction, "Interaction");
            if (GUILayout.Button(new GUIContent("SAVE", "Saves the complete interaction settings to file"), ICEEditorStyle.ButtonMiddle))
            {
                CreatureIO.SaveInteractionToFile(_control.Creature.Interaction, _control.gameObject.name);
            }
            if (GUILayout.Button(new GUIContent("LOAD", "Loads existing interaction settings form file"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Interaction = CreatureIO.LoadInteractionFromFile(_control.Creature.Interaction);
            }
            if (GUILayout.Button(new GUIContent("RESET", "Removes all interaction settings"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Interaction.Reset();
            }
            ICEEditorLayout.EndHorizontal(Info.INTERACTION);

            if (!_control.Display.FoldoutInteraction)
            {
                return;
            }

            EditorGUILayout.Separator();
            EditorGUI.indentLevel++;
            for (int _interactor_index = 0; _interactor_index < _control.Creature.Interaction.Interactors.Count; ++_interactor_index)
            {
                DrawInteractor(_control, _control.Creature.Interaction, _interactor_index);
            }
            EditorGUI.indentLevel--;

            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
            ICEEditorLayout.BeginHorizontal();
            EditorGUILayout.LabelField("Add Interactor", ICEEditorStyle.LabelBold);
            if (GUILayout.Button(new GUIContent("LOAD", "Load existing interactor settings from file"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Interaction.Interactors.Add(CreatureIO.LoadInteractorFromFile(new InteractorObject()));
            }
            if (GUILayout.Button(new GUIContent("ADD", "Create a new interactor record"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Interaction.Interactors.Add(new InteractorObject());
            }
            ICEEditorLayout.EndHorizontal();

            EditorGUILayout.Separator();
        }
コード例 #14
0
        public static void Print(ICECreatureRegister _register)
        {
            // HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();

            /*if( _register.UseReferenceCategories )
             *      ICEEditorLayout.Label( "Reference Objects", true );
             * else*/
            m_foldout = ICEEditorLayout.Foldout(m_foldout, "Reference Objects");

            if (_register.UseReferenceCategories)
            {
                int _res_foldout = ICEEditorLayout.ListFoldoutButtons <ReferenceGroupCategory>(_register.ReferenceGroupCategories);
                if (_res_foldout == 0 || _res_foldout == 1)
                {
                    foreach (ReferenceGroupCategory _cat in _register.ReferenceGroupCategories)
                    {
                        foreach (ReferenceGroupObject _group in _cat.ReferenceGroupObjects)
                        {
                            _group.Foldout = (_res_foldout == 1 ? true : _res_foldout == 0 ? false : _group.Foldout);
                        }
                    }
                }
            }
            else
            {
                ICEEditorLayout.ListFoldoutButtons <ReferenceGroupObject>(_register.ReferenceGroupObjects);
            }

            GUILayout.Space(5);

            _register.BreakAll = ICEEditorLayout.CheckButtonMiddle("BREAK", "Forces an interruption to all objects during runtime", _register.BreakAll);

            _register.UseReferenceCategories = ICEEditorLayout.CheckButtonMiddle("GROUPS", "Displays all reference objects in their respective entity groups.", _register.UseReferenceCategories);

            _register.UsePoolManagement = ICEEditorLayout.CheckButtonMiddle("POOL", "Activates/deactivates the Pool Management", _register.UsePoolManagement);

            // REFRESH REFERENCE OBJECTS BEGIN
            ICECreatureEntity[] _entities = GameObject.FindObjectsOfType <ICECreatureEntity>();
            EditorGUI.BeginDisabledGroup(_entities == null);
            if (_entities != null)
            {
                GUI.backgroundColor = (_entities.Length != _register.ReferenceGameObjects.Count ? Color.yellow : Color.green);
            }
            if (ICEEditorLayout.Button("UPDATE", "Updates the list of reference objects"))
            {
                _register.UpdateReferences();
            }
            GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor;
            EditorGUI.EndDisabledGroup();
            // REFRESH REFERENCE OBJECTS END

            ICEEditorLayout.EndHorizontal(ref _register.ShowReferencesInfo, ref _register.ReferencesInfo, Info.REGISTER_REFERENCE_OBJECTS);
            // HEADER END

            if (!m_foldout)              // && ! _register.UseReferenceCategories )
            {
                return;
            }

            EditorGUI.indentLevel++;

            if (_register.UseReferenceCategories)
            {
                foreach (ReferenceGroupCategory _cat in _register.ReferenceGroupCategories)
                {
                    if (_cat.ReferenceGroupObjects.Count > 0)
                    {
                        DrawReferenceGroupListCat(_register, _cat.Type.ToString(), _cat, ref _cat.Foldout);
                    }
                }
            }
            else
            {
                DrawReferenceGroupList(_register, _register.ReferenceGroupObjects);
            }

            EditorGUILayout.Separator();
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

            ICEEditorLayout.BeginHorizontal();
            GameObject _new = (GameObject)EditorGUILayout.ObjectField("Add Reference Object", null, typeof(GameObject), true);

            if (_new != null)
            {
                _register.AddReference(_new);
            }
            ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECTS_ADD);


            EditorGUI.indentLevel--;
            EditorGUILayout.Separator();
            ICEEditorStyle.SplitterByIndent(0);

            // REFRESH REFERENCE OBJECTS BEGIN
            EditorGUI.BeginDisabledGroup(_entities == null);
            if (_entities != null)
            {
                GUI.backgroundColor = (_entities.Length > _register.ReferenceGameObjects.Count ? Color.yellow : Color.green);
            }
            if (ICEEditorLayout.ButtonExtraLarge("UPDATE REFERENCE OBJECTS", "Updates the list of reference objects"))
            {
                _register.UpdateReferences();
            }
            GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor;
            EditorGUI.EndDisabledGroup();
            // REFRESH REFERENCE OBJECTS END
        }
コード例 #15
0
        private static void DrawReferenceGroup(ICECreatureRegister _register, ReferenceGroupObject _obj)
        {
            if (_obj == null || _obj.Foldout == false)
            {
                return;
            }

            EditorGUI.BeginDisabledGroup(_obj.Enabled == false);

            // BEGIN OBJECT
            ICEEditorLayout.BeginHorizontal();
            _obj.ReferenceGameObject = (GameObject)EditorGUILayout.ObjectField("Reference Object", _obj.ReferenceGameObject, typeof(GameObject), true);
            EditorGUI.BeginDisabledGroup(_obj.ReferenceGameObject == null);


            if (_obj.ReferenceGameObject != null)
            {
                ICEEditorLayout.ButtonDisplayObject(_obj.ReferenceGameObject.transform.position);
            }
            else
            {
                ICEEditorLayout.ButtonDisplayObject(Vector3.zero);
            }
            ICEEditorLayout.ButtonSelectObject(_obj.ReferenceGameObject, ICEEditorStyle.CMDButtonDouble);

            //_obj.GroupByTag = ICEEditorLayout.ButtonCheck( "TAG", "Allows to find a group in addition to its name also by its tag.", _obj.GroupByTag, ICEEditorStyle.CMDButtonDouble );
            _obj.GroupByTag = false;

            _obj.UseGroupParent = ICEEditorLayout.CheckButtonMiddle("GROUP", "Assorts instances to the defined Hierarchy Group", _obj.UseGroupParent);
            EditorGUI.EndDisabledGroup();
            ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT);
            // END OBJECT

            //_obj.UseHierarchyGroupObject = ICEEditorLayout.Toggle( "Use Hierarchy Group", "", _obj.UseHierarchyGroupObject, Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_USE );
            if (_obj.UseGroupParent)
            {
                EditorGUI.indentLevel++;
                ICEEditorLayout.BeginHorizontal();
                _obj.CustomGroupParent = (GameObject)EditorGUILayout.ObjectField("Custom Hierarchy Group", _obj.CustomGroupParent, typeof(GameObject), true);
                ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_CUSTOM);

                if (_obj.CustomGroupParent == null)
                {
                    EditorGUILayout.HelpBox(Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_INFO, MessageType.Info);
                }

                EditorGUI.indentLevel--;
            }

            // BEGIN POOL MANAGEMENT
            if (_obj.PoolManagementEnabled == true && _register.UsePoolManagement == true)
            {
                // PLAYER
                if (_obj.EntityType == EntityClassType.Player)
                {
                    _obj.MaxCoexistingObjects = 1;
                    _obj.UseInitialSpawn      = true;
                    _obj.InitialSpawnPriority = 0;
                    _obj.UseRandomization     = false;
                    _obj.SpawnWaveMin         = 1;
                    _obj.SpawnWaveMax         = 1;
                    _obj.UseSoftRespawn       = true;

                    ICEEditorLayout.MinMaxRandomDefaultSlider("Spawn Interval (min/max)", "", ref _obj.MinSpawnInterval, ref _obj.MaxSpawnInterval, 0, ref _obj.RespawnIntervalMax, 0, 0, 0.25f, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_INTERVAL);

                    if (_obj.MinSpawnInterval > 0 && _obj.ReferenceGameObject != null && _obj.ReferenceGameObject.GetComponentsInChildren <Camera>() != null)
                    {
                        //Debug.Log( "test" );
                    }
                }

                // CREATURES AND OTHER OBJECTS
                else
                {
                    ICEEditorLayout.BeginHorizontal();
                    float _maximum = _obj.MaxCoexistingObjectsMaximum;
                    _obj.MaxCoexistingObjects        = (int)ICEEditorLayout.MaxDefaultSlider("Max. Coexistent Objects (" + _obj.ActiveObjectsCount + ")", "Specifies the limit of coexistent objects", _obj.MaxCoexistingObjects, 1, 0, ref _maximum, 25, "");
                    _obj.MaxCoexistingObjectsMaximum = (int)_maximum;
                    _obj.UseMaxSpawnCycles           = ICEEditorLayout.CheckButtonSmall("MAX", "Specifies the total number of objects", _obj.UseMaxSpawnCycles);
                    _obj.UseInitialSpawn             = ICEEditorLayout.CheckButtonMiddle("INITIAL", "Spawns all instances on start according to the given priority", _obj.UseInitialSpawn);
                    ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_MAX);


                    if (_obj.UseMaxSpawnCycles)
                    {
                        if (_obj.MaxSpawnCycles < _obj.MaxCoexistingObjects)
                        {
                            _obj.MaxSpawnCycles = _obj.MaxCoexistingObjects;
                        }

                        if (_obj.MaxSpawnCyclesMaximum < _obj.MaxCoexistingObjectsMaximum)
                        {
                            _obj.MaxSpawnCyclesMaximum = _obj.MaxCoexistingObjectsMaximum;
                        }

                        float _max_spawn_cycles = _obj.MaxSpawnCyclesMaximum;
                        _obj.MaxSpawnCycles        = (int)ICEEditorLayout.MaxDefaultSlider("Max. Spawn Cycles (" + _obj.TotalSpawnCycles + ")", "", _obj.MaxSpawnCycles, 1, _obj.MaxCoexistingObjects, ref _max_spawn_cycles, 25, "");
                        _obj.MaxSpawnCyclesMaximum = (int)_max_spawn_cycles;
                    }

                    if (_obj.UseInitialSpawn)
                    {
                        EditorGUI.indentLevel++;
                        _obj.InitialSpawnPriority = (int)ICEEditorLayout.DefaultSlider("Initial Spawn Priority", "", _obj.InitialSpawnPriority, 1, 0, 100, 0, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_PRIORITY);
                        EditorGUI.indentLevel--;
                    }

                    ICEEditorLayout.BeginHorizontal();
                    ICEEditorLayout.MinMaxRandomDefaultSlider("Spawn Interval (min/max)", "", ref _obj.MinSpawnInterval, ref _obj.MaxSpawnInterval, 0, ref _obj.RespawnIntervalMax, 0, 0, 0.25f, 30);
                    _obj.UseSpawnWave = ICEEditorLayout.CheckButton("WAVE", "", _obj.UseSpawnWave, ICEEditorStyle.ButtonMiddle);
                    ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_INTERVAL);

                    if (_obj.UseSpawnWave)
                    {
                        EditorGUI.indentLevel++;
                        ICEEditorLayout.MinMaxRandomDefaultSlider("Wave Size (min/max)", "Amount per Wave", ref _obj.SpawnWaveMin, ref _obj.SpawnWaveMax, 1, ref _obj.SpawnWaveMaximum, 1, 5, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_WAVE);
                        EditorGUI.indentLevel--;
                    }

                    EditorGUILayout.Separator();


                    _obj.UseRandomization = ICEEditorLayout.Toggle("Spawn Randomization", "", _obj.UseRandomization, Info.REGISTER_REFERENCE_OBJECT_POOL_RANDOM_SIZE);
                    if (_obj.UseRandomization)
                    {
                        EditorGUI.indentLevel++;
                        ICEEditorLayout.MinMaxRandomDefaultSlider("Random Size Variance (min/max)", "", ref _obj.RandomSizeMin, ref _obj.RandomSizeMax, -1, 1, 0, 0, 0.025f, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_RANDOM_SIZE_VARIANCE);
                        EditorGUI.indentLevel--;
                        EditorGUILayout.Separator();
                    }

                    WorldObjectEditor.DrawCullingOptionsObject(_register, _obj.CullingOptions, EditorHeaderType.TOGGLE, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_CONDITIONS, "Spawn Conditions");
                }

                ICEEditorLayout.BeginHorizontal();
                ICEEditorLayout.Label("Spawn Areas", false);
                if (ICEEditorLayout.AddButton("Adds a new spawn point entry"))
                {
                    _obj.SpawnPoints.Add(new SpawnPointObject());
                }
                ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_SPAWN_POINTS);

                EditorGUI.indentLevel++;

                if (_obj.SpawnPoints.Count == 0)
                {
                    if (_obj.EntityCreature != null)
                    {
                        _obj.SpawnPoints.Add(new SpawnPointObject(_obj.EntityCreature.Creature.Essentials.Target));
                    }
                    else if (_obj.ReferenceGameObject != null)
                    {
                        ICECreatureTargetAttribute _target = _obj.ReferenceGameObject.GetComponent <ICECreatureTargetAttribute>();
                        if (_target != null)
                        {
                            _obj.SpawnPoints.Add(new SpawnPointObject(_target.Target));
                        }
                        else
                        {
                            _obj.SpawnPoints.Add(new SpawnPointObject(_obj.ReferenceGameObject));
                        }
                    }
                }

                foreach (SpawnPointObject _point in _obj.SpawnPoints)
                {
                    if (CreatureObjectEditor.DrawSpawnPointObject(_point, _obj.SpawnPoints, EditorHeaderType.FOLDOUT_ENABLED))
                    {
                        return;
                    }
                }

                EditorGUI.indentLevel--;
            }
            // END POOL MANAGEMENT

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }
コード例 #16
0
        private static void DrawReferenceGroupListCat(ICECreatureRegister _register, string _list_title, ReferenceGroupCategory _cat, ref bool _foldout)
        {
            if (_cat == null || _cat.ReferenceGroupObjects == null)
            {
                return;
            }

            List <ReferenceGroupObject> _list = _cat.ReferenceGroupObjects;

            EditorGUI.BeginDisabledGroup(_list.Count == 0);

            // HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _list_title += " (" + _list.Count + ")";
            _foldout     = ICEEditorLayout.Foldout(_foldout, _list_title, "");

            ICEEditorLayout.ListFoldoutButtons <ReferenceGroupObject>(_list);

            ICEEditorLayout.EndHorizontal(ref _cat.ShowInfoText, ref _cat.InfoText, Info.REGISTER_REFERENCE_CAT);
            // HEADER END

            EditorGUI.indentLevel++;
            if (_foldout)
            {
                for (int _index = 0; _index < _list.Count; _index++)
                {
                    ReferenceGroupObject _group = _list[_index];

                    UpdateStatus(_group);

                    if (_group != null && _group.ReferenceGameObject != null)
                    {
                        ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);
                        ICEEditorLayout.BeginHorizontal();
                        EditorGUI.BeginDisabledGroup(_group.Enabled == false);
                        _group.Foldout = EditorGUILayout.Foldout(_group.Foldout, GetTitleText(_group), ICEEditorStyle.Foldout);
                        GUILayout.FlexibleSpace();


                        EditorGUI.BeginDisabledGroup(_group.EntityComponent == null);
                        _group.Break = ICEEditorLayout.CheckButtonMiddle("BREAK", "Deactivates/activates all entity components", _group.Break);
                        EditorGUI.EndDisabledGroup();


                        _group.UseSoftRespawn = ICEEditorLayout.CheckButtonMiddle("RECYCLE", "Allows the reuse of suspended objects without new instantiations", _group.UseSoftRespawn);


                        EditorGUI.BeginDisabledGroup(_register.UsePoolManagement == false);
                        _group.PoolManagementEnabled = ICEEditorLayout.CheckButtonMiddle("POOL", "Activates Pool Management", _group.PoolManagementEnabled);
                        EditorGUI.EndDisabledGroup();
                        EditorGUI.EndDisabledGroup();

                        _group.Enabled = ICEEditorLayout.EnableButton("Enables/Disables the group", _group.Enabled);

                        if (ICEEditorLayout.ListDeleteButtonMini <ReferenceGroupObject>(_register.ReferenceGroupObjects, _group, "Removes this reference group."))
                        {
                            return;
                        }

                        ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_GROUP);


                        DrawReferenceGroup(_register, _group);
                    }
                    else
                    {
                        _list.RemoveAt(_index);
                        --_index;
                    }
                }

                if (_list.Count > 0)
                {
                    EditorGUILayout.Separator();
                }
            }
            EditorGUI.indentLevel--;
            EditorGUI.EndDisabledGroup();
        }
コード例 #17
0
        public static void Print(ICECreatureControl _control)
        {
            if (m_creature_register == null)
            {
                m_creature_register = ICECreatureRegister.Instance;
            }

            if (m_creature_register == null)
            {
                return;
            }

            if (!_control.Display.ShowInteraction)
            {
                return;
            }

            ICEEditorStyle.SplitterByIndent(0);
            ICEEditorLayout.BeginHorizontal();
            _control.Display.FoldoutInteraction = ICEEditorLayout.Foldout(_control.Display.FoldoutInteraction, "Interaction");

            if (ICEEditorLayout.SaveButton("Saves the complete interaction settings to file"))
            {
                CreatureEditorIO.SaveInteractionToFile(_control.Creature.Interaction, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads existing interaction settings form file"))
            {
                _control.Creature.Interaction = CreatureEditorIO.LoadInteractionFromFile(_control.Creature.Interaction);
            }
            if (ICEEditorLayout.ResetButton("Removes all interaction settings"))
            {
                _control.Creature.Interaction.Reset();
            }

            //	GUILayout.Space( 5 );
            //if( ICEEditorLayout.ListDeleteButton<InteractorObject>( _control.Creature.Interaction.Interactors, _waypoint ) )
            //	return true;

            GUILayout.Space(5);
            InteractorFoldoutButtons(_control.Creature.Interaction.Interactors);

            ICEEditorLayout.EndHorizontal(Info.INTERACTION);

            if (!_control.Display.FoldoutInteraction)
            {
                return;
            }

            EditorGUILayout.Separator();
            EditorGUI.indentLevel++;
            for (int _interactor_index = 0; _interactor_index < _control.Creature.Interaction.Interactors.Count; ++_interactor_index)
            {
                if (DrawInteractor(_control, _control.Creature.Interaction, _interactor_index))
                {
                    return;
                }
            }
            EditorGUI.indentLevel--;

            string _tmp_title = "Add Interactor";

            ICEEditorLayout.DrawListAddLine <InteractorObject>(_control.Creature.Interaction.Interactors, new InteractorObject(), _tmp_title);
        }
コード例 #18
0
        public static void Print(string _name)
        {
            EditorGUILayout.LabelField(_name + "", ICEEditorStyle.LabelBold);

            EditorGUILayout.Separator();


            m_creature_register = ICECreatureRegister.Register;

            if (m_creature_register == null)
            {
                Info.Warning(Info.REGISTER_MISSING);

                ICEEditorLayout.BeginHorizontal();
                ICEEditorLayout.Label("Add Creature Register", true);
                if (GUILayout.Button("ADD REGISTER", ICEEditorStyle.ButtonLarge))
                {
                    GameObject _object = new GameObject();
                    m_creature_register = _object.AddComponent <ICECreatureRegister>();
                    _object.name        = "CreatureRegister";

                    if (m_creature_register != null)
                    {
                        m_creature_register.Scan();
                    }
                }
                ICEEditorLayout.EndHorizontal(Info.REGISTER);
            }
            else if (!m_creature_register.isActiveAndEnabled)
            {
                Info.Warning(Info.REGISTER_DISABLED);

                ICEEditorLayout.BeginHorizontal();
                ICEEditorLayout.Label("Activate Creature Register", true);
                if (GUILayout.Button("ACTIVATE", ICEEditorStyle.ButtonLarge))
                {
                    m_creature_register.gameObject.SetActive(true);
                }
                ICEEditorLayout.EndHorizontal(Info.REGISTER);
            }
            else
            {
                ICEEditorLayout.BeginHorizontal();

                GameObject _registered_object = DrawRegisterPopup("Creature Register");

                if (_registered_object != null)
                {
                    if (GUILayout.Button("SELECT", ICEEditorStyle.ButtonMiddle))
                    {
                        Selection.activeGameObject = _registered_object;
                    }
                }
                else
                {
                    if (GUILayout.Button("SCAN", ICEEditorStyle.ButtonMiddle))
                    {
                        m_creature_register.Scan();
                    }
                }

                if (GUILayout.Button("REGISTER", ICEEditorStyle.ButtonMiddle))
                {
                    Selection.activeGameObject = m_creature_register.gameObject;
                }

                ICEEditorLayout.EndHorizontal(Info.REGISTER);
            }
        }