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

            _relevancyList.DoLayoutList();
            _spawnerVolume.DoLayoutList();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Editor tools", UnityEditor.EditorStyles.boldLabel);
            var t = (SpawnerBase)target;

            if (t.hasSpawnedObjects)
            {
                if (GUILayout.Button("Delete preview items"))
                {
                    t.DestroyAllSpawnedObjects();
                }
            }
            else
            {
                if (GUILayout.Button("Test spawn"))
                {
                    TryInit(t.GetComponent <IObjectRelevancy>() as UnityEngine.Object);
                    TryInit(t.GetComponent <ISpawnerVolume>() as UnityEngine.Object);

                    t.Spawn();
                }
            }
        }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        var t = (UIWindow)target;

        base.OnInspectorGUI();

        if (Application.isPlaying)
        {
            if (t.isVisible)
            {
                EditorGUILayout.LabelField("Window is Visible");
                if (GUILayout.Button("Hide"))
                {
                    t.Hide();
                }
            }
            else
            {
                EditorGUILayout.LabelField("Window is Hidden");
                if (GUILayout.Button("Show"))
                {
                    t.Show();
                }
            }
        }

        _inputHandlers.DoLayoutList();
    }
        public override void OnInspectorGUI()
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));

            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("Hold shift to add waypoints\nHold ctrl to delete waypoints", MessageType.Info);

            EditorGUILayout.LabelField("Waypoint Group Properties", EditorStyles.boldLabel);

            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, "m_Script");
            serializedObject.ApplyModifiedPropertiesWithoutUndo();

            var group = (WaypointGroup)target;

            _waypointActions.DoLayoutList();
            _waypointConditions.DoLayoutList();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Editor Tools", EditorStyles.boldLabel);
            if (GUILayout.Button("Center pivot"))
            {
                Undo.RecordObject(group, "Centered Waypoints");
                group.CenterPivot();
            }
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));
            DrawPropertiesExcluding(serializedObject, "m_Script");

            _waypointActions.DoLayoutList();
            _waypointConditions.DoLayoutList();
        }
        public override void OnInspectorGUI()
        {
            var t = (ObserverAggroBehaviour)target;

            base.OnInspectorGUI();
            DrawSep();
            GUILayout.Label("Debug values", Devdog.General.Editors.EditorStyles.titleStyle);
            GUILayout.Label("Current aggro:\t" + t.currentAggro + " / " + t.maxAggro);
            GUILayout.Label("Start location:\t" + t.startLocation);
            GUILayout.Label("Distance from start:\t" + (EditorApplication.isPlaying ? Vector3.Distance(t.transform.position, t.startLocation).ToString() : "-"));
            GUILayout.Label("Active module count:\t" + t.aggroComponents.Where(o => o != null).Cast <IObserverAggroModule>().Count(o => o.enabled));
            DrawSep();

            if (EditorApplication.isPlaying)
            {
                foreach (var info in t.observer.targetsInRange)
                {
                    if (_aggroModulesFoldout.ContainsKey(info.target) == false)
                    {
                        _aggroModulesFoldout.Add(info.target, false);
                    }
                }

                GUILayout.Label("Aggro values", Devdog.General.Editors.EditorStyles.titleStyle);
                var aggro = t.observer.targetsInRange.Where(o => t.GetAggroForTarget(o.target) != null).OrderByDescending(o => t.GetAggroForTarget(o.target).finalValue);
                foreach (var info in aggro)
                {
                    var foldout = new GUIStyle(EditorStyles.foldout);
                    foldout.fontStyle = FontStyle.Bold;

                    if (info.target == t.GetTargetWithHighestAggro().target)
                    {
                        GUI.color = Color.green;
                    }
                    _aggroModulesFoldout[info.target] = EditorGUILayout.Foldout(_aggroModulesFoldout[info.target], info.target.name + "\t-\t" + t.GetAggroForTarget(info.target), foldout);
                    if (_aggroModulesFoldout[info.target])
                    {
                        DrawModuleOutputForTarget(info.target);
                    }

                    GUI.color = Color.white;
                }

                DrawSep();
            }

            var before = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth *= 1.6f;
            _moduleList.DoLayoutList();

            EditorGUIUtility.labelWidth = before;
        }