コード例 #1
0
        private void OnDrawGizmos()
        {
            ICECreatureRegister _register = ICECreatureRegister.Instance;

            if (_register == null)
            {
                return;
            }

            if (!_register.RegisterDebug.UseDrawSelected)
            {
                DrawRegisterGizmos();
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            m_creature_register = (ICECreatureRegister)target;

            GUI.changed          = false;
            Info.HelpButtonIndex = 0;

            EditorGUI.indentLevel++;
            RegisterOptionsEditor.Print(m_creature_register);
            RegisterGroupsEditor.Print(m_creature_register);
            EditorGUI.indentLevel--;

            EditorGUILayout.Separator();
            MarkSceneDirty(m_creature_register);
        }
コード例 #3
0
        /// <summary>
        /// Draws the entity settings.
        /// </summary>
        /// <param name="_entity">Entity.</param>
        public static void DrawEntitySettings(ICECreatureEntity _entity)
        {
            if (_entity == null)
            {
                return;
            }

            if (_entity.EntityType == ICE.World.EnumTypes.EntityClassType.Creature && Application.isPlaying)
            {
                EditorGUILayout.HelpBox(Info.DISPLAY_OPTIONS_RUNTIME_INFO, MessageType.Info);
            }

            EditorGUILayout.Separator();

            if (ICECreatureRegister.Instance == null)
            {
                GUI.backgroundColor = Color.yellow;
                if (ICEEditorLayout.ButtonExtraLarge("ADD CREATURE REGISTER", Info.REGISTER_MISSING))
                {
                    ICECreatureRegister.Create();
                }

                GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor;
            }
            else if (!ICECreatureRegister.Instance.isActiveAndEnabled)
            {
                GUI.backgroundColor = Color.yellow;
                if (ICEEditorLayout.ButtonExtraLarge("ACTIVATE CREATURE REGISTER", Info.REGISTER_DISABLED))
                {
                    ICECreatureRegister.Instance.gameObject.SetActive(true);
                }
                GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor;
            }
            else
            {
                Popups.QuickSelectionPopup("Quick Selection", _entity);
            }

            ICEEditorLayout.BeginHorizontal();

            ICEEditorLayout.PrefixLabel("Debug Options");

            GUILayout.FlexibleSpace();

            _entity.UseDebugLogs = ICEEditorLayout.DebugButtonSmall("LOG", "Print debug information for this GameObject", _entity.UseDebugLogs);
            EditorGUI.BeginDisabledGroup(_entity.UseDebugLogs == false);
            if (_entity.UseDebugLogs)
            {
                _entity.UseDebugLogsSelectedOnly = ICEEditorLayout.DebugButtonMini("S", "Shows debug information for selected GameObjects only.", _entity.UseDebugLogsSelectedOnly);
            }
            else
            {
                ICEEditorLayout.DebugButtonMini("S", "Shows debug information for selected GameObjects only.", false);
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(3);

            _entity.UseDebugRays = ICEEditorLayout.DebugButtonSmall("RAY", "Shows debug rays for this GameObject", _entity.UseDebugRays);
            EditorGUI.BeginDisabledGroup(_entity.UseDebugRays == false);
            if (_entity.UseDebugRays)
            {
                _entity.UseDebugRaysSelectedOnly = ICEEditorLayout.DebugButtonMini("S", "Shows debug rays for selected GameObjects only.", _entity.UseDebugRaysSelectedOnly);
            }
            else
            {
                ICEEditorLayout.DebugButtonMini("S", "Shows debug rays for selected GameObjects only.", false);
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(3);

            _entity.UseDebug = ICEEditorLayout.DebugButton("DEBUG", "Enables enhanced debug options", _entity.UseDebug);
            GUILayout.Space(3);

            EditorGUI.BeginDisabledGroup(_entity as ICECreatureControl == null);
            _entity.ShowInfo = ICEEditorLayout.DebugButton("INFO", "Displays runtime information.", _entity.ShowInfo);
            EditorGUI.EndDisabledGroup();

            _entity.ShowHelp  = ICEEditorLayout.DebugButton("HELP", "Displays all help informations", _entity.ShowHelp);
            _entity.ShowNotes = ICEEditorLayout.DebugButton("NOTES", "Displays all note fields", _entity.ShowNotes);
            ICEEditorLayout.EndHorizontal(Info.ENTITY_DEBUG_OPTIONS);
        }
コード例 #4
0
        private void DrawRegisterGizmos()
        {
            ICECreatureRegister _register = ICECreatureRegister.Instance;

            if (_register == null)
            {
                return;
            }

            if (!_register.UseDebug)
            {
                return;
            }

            Gizmos.color = new Color(Color.blue.r, Color.blue.g, Color.blue.b, 0.75f);
            Vector3 _s = new Vector3(0.5f, 0.15f, 0.5f);

            Gizmos.DrawCube(transform.position + (Vector3.up * 0.25f), _s);
            Gizmos.DrawCube(transform.position + (Vector3.up * 0.50f), _s);
            Gizmos.DrawCube(transform.position + (Vector3.up * 0.75f), _s);
            Gizmos.color = new Color(Color.blue.r, Color.blue.g, Color.blue.b, 1f);
            CustomGizmos.Text("CREATURE REGISTER", transform.position, Gizmos.color, 14, FontStyle.Bold);

            foreach (ReferenceGroupObject _group in _register.ReferenceGroupObjects)
            {
                if (_group.ReferenceGameObject == null)
                {
                    continue;
                }

                if (_register.RegisterDebug.ShowReferenceGizmos && !_group.Status.isPrefab)
                {
                    Gizmos.color = new Color(_register.RegisterDebug.ColorReferences.r, _register.RegisterDebug.ColorReferences.g, _register.RegisterDebug.ColorReferences.b, 0.25f);
                    Vector3 _pos  = _group.ReferenceGameObject.transform.position;
                    float   _size = Mathf.Clamp(_group.ReferenceGameObject.transform.lossyScale.magnitude, 0.25f, 1) * 0.25f;
                    Gizmos.DrawSphere(_pos, _size);
                    _pos.y += 2;

                    if (_register.RegisterDebug.ShowReferenceGizmosText)
                    {
                        Gizmos.color = new Color(_register.RegisterDebug.ColorReferences.r, _register.RegisterDebug.ColorReferences.g, _register.RegisterDebug.ColorReferences.b, 1f);
                        CustomGizmos.Text(_group.ReferenceGameObject.name + " (SCENE REFERENCE)", _pos, Gizmos.color, 12, FontStyle.Italic);
                    }
                }

                if (_register.RegisterDebug.ShowCloneGizmos)
                {
                    foreach (GameObject _item in _group.ActiveObjects)
                    {
                        if (_group.ReferenceGameObject == _item)
                        {
                            continue;
                        }

                        Gizmos.color = new Color(_register.RegisterDebug.ColorClones.r, _register.RegisterDebug.ColorClones.g, _register.RegisterDebug.ColorClones.b, 0.25f);
                        Vector3 _pos  = _item.transform.position;
                        float   _size = Mathf.Clamp(_item.transform.lossyScale.magnitude, 0.25f, 1) * 0.25f;
                        Gizmos.DrawSphere(_pos, _size);

                        if (_register.RegisterDebug.ShowCloneGizmosText)
                        {
                            _pos.y      += 2;
                            Gizmos.color = new Color(_register.RegisterDebug.ColorClones.r, _register.RegisterDebug.ColorClones.g, _register.RegisterDebug.ColorClones.b, 1f);
                            CustomGizmos.Text(_item.name + " (CLONE)", _pos, Gizmos.color, 12, FontStyle.Italic);
                        }
                    }
                }

                if (_register.RegisterDebug.ShowSpawnPointGizmos && _group.PoolManagementEnabled)
                {
                    foreach (SpawnPointObject _point in _group.ValidSpawnPoints)
                    {
                        if (_point.SpawnPointGameObject == null)
                        {
                            continue;
                        }

                        GameObject[] _objects = _point.GetAllSpawnPointGameObjects();

                        foreach (GameObject _object in _objects)
                        {
                            Gizmos.color = new Color(_register.RegisterDebug.ColorSpawnPoints.r, _register.RegisterDebug.ColorSpawnPoints.g, _register.RegisterDebug.ColorSpawnPoints.b, 0.25f);
                            Vector3 _pos  = _object.transform.position;
                            float   _size = Mathf.Clamp(_object.transform.lossyScale.magnitude, 0.25f, 1) * 0.25f;
                            Gizmos.DrawSphere(_pos, _size);

                            if (_point.UseRandomRect)
                            {
                                CustomGizmos.Box(_object.transform, _point.RandomRect, new Vector3(0, _point.RandomRect.y * 0.5f, 0));
                            }
                            else
                            {
                                CustomGizmos.Circle(_pos, _point.SpawningRangeMin, CustomGizmos.GetBestDegrees(_point.SpawningRangeMin, 360), false);
                                CustomGizmos.BeamCircle(_pos, _point.SpawningRangeMax, CustomGizmos.GetBestDegrees(_point.SpawningRangeMax, 360), false, _point.SpawningRangeMax - _point.SpawningRangeMin, "", false, true);
                            }

                            if (_register.RegisterDebug.ShowSpawnPointGizmosText)
                            {
                                _pos.z      += _point.SpawningRangeMax;
                                _pos.y      += 4;
                                Gizmos.color = new Color(_register.RegisterDebug.ColorSpawnPoints.r, _register.RegisterDebug.ColorSpawnPoints.g, _register.RegisterDebug.ColorSpawnPoints.b, 1f);
                                CustomGizmos.Text(_point.SpawnPointGameObject.name + " (SP)", _pos, Gizmos.color, 12, FontStyle.Italic);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
 public virtual void OnEnable()
 {
     m_creature_register = (ICECreatureRegister)target;
 }