예제 #1
0
        public void Awake()
        {
            if (entityType == null)
            {
                Debug.LogError(name + ": Missing Entity Type.  Please fix.");
                return;
            }
            entityLayers = LayerMask.GetMask("Agent", "WorldObject", "Area", "AgentEvent");

            // TODO: Get rid of inside area stuff?
            //AddAllInsideAreas();

            GameObject managerGameObject = GameObject.Find("TotalAIManager");

            if (managerGameObject == null)
            {
                Debug.LogError("Please add an Empty GameObject named TotalAIManager to the scene and add TotalAIManager component to it.");
                return;
            }
            totalAIManager = managerGameObject.GetComponent <TotalAIManager>();
            if (totalAIManager == null)
            {
                Debug.LogError("Please add TotalAIManager component to the TotalAIManager GameObject.");
                return;
            }
        }
예제 #2
0
        private void Start()
        {
            if (manager != null)
            {
                Debug.LogError("Multiple TotalAIManagers in the scene - Please Fix.");
                return;
            }
            manager = this;

            if (manager.settings == null)
            {
                Debug.LogError("TotalAIManager has no TotalAISettings set - Please Fix.");
                return;
            }

            guiManager = FindObjectOfType <GUIManager>();

            // Create the IC to MT/OC Dict for quick Matching when planning
            CreateICToMTDictionary();

            CreateTypeCategoryToIOTsDictionary();

            // Update NavMesh
            CreateMovementTypeList();
            UpdateAllNavMeshes();
        }
예제 #3
0
 private void OnEnable()
 {
     manager = FindObjectOfType <TotalAIManager>();
     if (manager != null)
     {
         ResetCachedMatches();
     }
 }
예제 #4
0
        // Called before play to keep these lists up to date
        public static void CreateTypeLists(TotalAIManager manager)
        {
            List <TypeCategory> allTCs = new List <TypeCategory>();
            var guids = AssetDatabase.FindAssets("t:TypeCategory");

            foreach (string guid in guids)
            {
                allTCs.Add((TypeCategory)AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)));
            }

            manager.allTypeCategories = new List <TypeCategory>();
            foreach (TypeCategory typeCategory in allTCs)
            {
                manager.allTypeCategories.Add(typeCategory);
            }

            List <InputOutputType> allIOTs = new List <InputOutputType>();

            guids = AssetDatabase.FindAssets("t:InputOutputType");
            foreach (string guid in guids)
            {
                allIOTs.Add((InputOutputType)AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)));
            }

            manager.allInputOutputTypes = new List <InputOutputType>();
            manager.allEntityTypes      = new List <EntityType>();
            foreach (InputOutputType inputOutputType in allIOTs)
            {
                manager.allInputOutputTypes.Add(inputOutputType);
                if (inputOutputType is EntityType)
                {
                    manager.allEntityTypes.Add((EntityType)inputOutputType);
                }
            }

            List <TypeGroup> allTypeGroups = new List <TypeGroup>();

            guids = AssetDatabase.FindAssets("t:TypeGroup");
            foreach (string guid in guids)
            {
                allTypeGroups.Add((TypeGroup)AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)));
            }

            manager.allTypeGroups = new List <TypeGroup>();
            foreach (TypeGroup typeGroup in allTypeGroups)
            {
                manager.allTypeGroups.Add(typeGroup);
            }

            EditorUtility.SetDirty(manager);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
예제 #5
0
        private static void UpdateManagerTypeLists(PlayModeStateChange playModeStateChange)
        {
            if (playModeStateChange == PlayModeStateChange.ExitingEditMode)
            {
                TotalAIManager manager = Object.FindObjectOfType <TotalAIManager>();
                if (manager == null)
                {
                    Debug.LogError("No TotalAIManager in the scene - Please Fix.");
                    return;
                }

                TotalAIManager.CreateTypeLists(manager);

                TypeCategory.UpdateTypeCategoriesChildren();
            }
        }