Ejemplo n.º 1
0
        public static void DrawAIActions(AI _ai, SimpleAIConfig gameConfig)
        {
            for (int i = 0; i < _ai.actions.Length; i++)
            {
                try
                {
                    EditorGUILayout.BeginVertical("box");
                    EditorGUILayout.BeginHorizontal();

                    Rect r = EditorGUILayout.GetControlRect();
                    r.height = 22;
                    r.y     += 1;

                    GUIStyle style = new GUIStyle(GUI.skin.GetStyle("HelpBox"));
                    style.richText         = true;
                    style.normal.textColor = _ai.actions[i].color;
                    style.fontSize         = 13;

                    EditorGUI.LabelField(r, "<b>" + _ai.actions[i].name + "</b>", style);


                    if (GUILayout.Button("Edit", new GUILayoutOption[] { GUILayout.Width(50), GUILayout.Height(21) }))
                    {
                        SimpleAIWindow.OpenWindow(_ai, i);
                    }

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Space();

                    _ai.actions[i].relevance = EditorGUILayout.IntSlider("Relevance", _ai.actions[i].relevance, 1, 10);

                    EditorGUILayout.EndVertical();
                }
                catch (Exception e)
                {
                    Debug.LogError(e.Message);
                    continue;
                }
            }
        }
Ejemplo n.º 2
0
        public static void BehavioursTemplate(AI _ai, SimpleAIConfig gameConfig)
        {
            EditorGUILayout.LabelField(Language.numberOfBehaviours(gameConfig.selectedLanguage), EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("-"))
            {
                if (_ai.actions.Length > 0)
                {
                    Array.Resize <AIAction>(ref _ai.actions, _ai.actions.Length - 1);
                    _ai.save();
                }
            }

            GUIStyle BoxNumberCenterStyle;

            BoxNumberCenterStyle           = new GUIStyle();
            BoxNumberCenterStyle.alignment = TextAnchor.MiddleCenter;
            BoxNumberCenterStyle.fontStyle = FontStyle.Bold;

            GUILayout.Box(_ai.actions.Length.ToString(), BoxNumberCenterStyle);

            if (GUILayout.Button("+"))
            {
                Array.Resize <AIAction>(ref _ai.actions, _ai.actions.Length + 1);
                _ai.actions[_ai.actions.Length - 1] = new AIAction();
                _ai.save();

                SimpleAIWindow.OpenWindow(_ai, _ai.actions.Length);
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(2f);

            DrawAIActions(_ai, gameConfig);
        }