コード例 #1
0
        /// <summary>
        /// Debugs the client info.
        /// </summary>
        /// <returns>The client info.</returns>
        /// <param name="taskNetwork">Task network.</param>
        public static string ClientStateInfo(TaskNetworkComponent taskNetwork)
        {
            string clientInfo = "";

            foreach (UtilityAIClient client in taskNetwork.clients)
            {
                clientInfo = client.ai + " | State: " + client.state + "\n";
                foreach (KeyValuePair <IQualifier, float> item in client.selectorResults)
                {
                    IQualifier qualifier = item.Key;
                    float      score     = item.Value;

                    var action     = qualifier.action;
                    var actionName = action.GetType().Name;
                    if (action is ActionWithOptions <Vector3> )
                    {
                        var _action = action as ActionWithOptions <Vector3>;
                        action = _action;
                        //actionName = _action.name;
                    }

                    if (client.currentAction == action)
                    {
                        clientInfo += string.Format(" <b>Qualifier:</b> {0} | <b>Score:</b>: <color=lime>{1}</color>\n <b>Action:</b>:  <color=lime>{2}</color>\n", qualifier.GetType().Name, score, actionName);
                    }
                    else
                    {
                        clientInfo += string.Format(" <b>Qualifier:</b> {0} | <b>Score:</b>: {1}\n <b>Action:</b>:  {2}\n", qualifier.GetType().Name, score, actionName);
                    }
                }
            }


            return(clientInfo);
        }
コード例 #2
0
        public override void Init(AddClientWindow window, TaskNetworkComponent taskNetwork)
        {
            this.taskNetwork         = taskNetwork;
            this.window              = window;
            this.window.minSize      = this.window.maxSize = new Vector2(windowMinSize, windowMaxSize);
            this.window.titleContent = new GUIContent(windowTitle);

            this.window.ShowUtility();
        }
コード例 #3
0
        void OnEnable()
        {
            taskNetwork   = target as TaskNetworkComponent;
            taskNetworkSO = new SerializedObject(taskNetwork);

            //UpdateClientList();

            //selectorConfigInfo = activeClient != null ? DebugEditorUtilities.SelectorConfig(activeClient.configuration.selector) : "No Selected Selector";
            selectorConfigInfo = activeClient != null?DebugEditorUtilities.SelectorConfig(activeClient.configuration.rootSelector) : "No Selected Selector";
        }
コード例 #4
0
        private void Awake()
        {
            taskNetwork     = GetComponent <TaskNetworkComponent>();
            contextProvider = GetComponent <AIContextProvider>();


            aiSight = GetComponent <AIPerceptionComponent>();


            aiSteer = GetComponent <EntityAISteering>();
        }
コード例 #5
0
        /// <summary>
        /// Shows the options window.
        /// </summary>
        /// <param name="editor">Editor.</param>
        /// <param name="optionType">Option type.</param>
        /// <typeparam name="T">The 1st type parameter.</typeparam>
        public static void ShowOptionsWindow <T>(TaskNetworkComponent taskNetwork, Type optionType = null) where T : OptionsWindow <T>, new()
        {
            T window = new T();

            if (optionType == null)
            {
                window.Init(window, taskNetwork);
            }
            else
            {
                window.Init(window, taskNetwork, optionType);
            }
        }
コード例 #6
0
        void Awake()
        {
            taskNetwork = GetComponent <TaskNetworkComponent>();

            values = (int[])System.Enum.GetValues(typeof(KeyCode));
            keys   = new bool[values.Length];


            textStyle = new GUIStyle();
            textStyle.normal.textColor = Color.white;
            textStyle.fontSize         = fontSize;
            textStyle.richText         = true;
        }
コード例 #7
0
        public override void Init(AddOptionsWindow window, TaskNetworkComponent taskNetwork, Type type)
        {
            displayTypes = GetAllOptions(type);
            windowTitle  = string.Format("{0} Search | AI Object Selector", type.Name);
            //windowTitle = string.Format("{0} Search | AI Object Selector", TaskNetworkEditorUtilities.GetAiCategoryName<T>() );

            this.taskNetwork = taskNetwork;

            this.window              = window;
            this.window.minSize      = this.window.maxSize = new Vector2(windowMinSize, windowMaxSize);
            this.window.titleContent = new GUIContent(windowTitle);

            this.window.ShowUtility();
        }
コード例 #8
0
        public static void CreateClientDrawer(string aiName, TaskNetworkComponent taskNetwork, bool isDemoAI = false)
        {
            int    windowSize        = 250;
            string defaultAiID       = "NewUtilityAI";
            string defaultAiName     = "New Utility AI";
            string defaultDemoAiID   = "NewDemoMockAI";
            string defaultDemoAiName = "NewDemoMockAI";

            string _defaultAiID   = isDemoAI == false ? defaultDemoAiID : defaultAiID;
            string _defaultAiName = isDemoAI == false ? defaultDemoAiName : defaultAiName;

            using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                EditorGUILayout.LabelField("New AI Name", Styles.TextCenterStyle);
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Name: ", GUILayout.Width(windowSize * 0.18f));
                    aiName = GUILayout.TextField(aiName);
                }
                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Ok"))
                    {
                        var utilityAIAsset = new UtilityAIAsset();
                        //var aiAsset = utilityAIAsset.CreateAsset(String.IsNullOrEmpty(aiName) || String.IsNullOrWhiteSpace(aiName) ? _defaultAiID : aiName,
                        //String.IsNullOrEmpty(aiName) || String.IsNullOrWhiteSpace(aiName) ? _defaultAiName : aiName,
                        //taskNetwork.selectAiAssetOnCreate);

                        //editor.AddUtilityAIAsset(aiAsset);
                        //CloseWindow();
                    }
                    if (GUILayout.Button("Cancel"))
                    {
                        //CloseWindow();
                    }
                }
            }
        }
コード例 #9
0
 void Awake()
 {
     utilityAIComponent = gameObject.GetComponent <TaskNetworkComponent>();
     contextProvider    = utilityAIComponent.contextProvider;
     context            = utilityAIComponent.context;
 }
コード例 #10
0
 public virtual void Init(T window, TaskNetworkComponent taskNetwork, Type type)
 {
     Init(window, taskNetwork);
 }
コード例 #11
0
 public virtual void Init(T window, TaskNetworkComponent taskNetwork)
 {
 }
コード例 #12
0
        ///<summary>
        ///Gets an AI by ID.
        ///</summary>
        ///<param name = "id" > The ID.</param>
        ///<returns> The AI with the specified ID, or null if no match is found.</returns>
        public static TaskNetworkComponent GetAI(string id)
        {
            TaskNetworkComponent ai = null;

            return(ai);
        }