public override void OnInspectorGUI() { GUILayout.Label("AI PATROL POINTS LIST", EditorStyles.boldLabel); DrawDefaultInspector(); if (presetsData == null) { presetsData = Resources.Load <AI_PresetsSave>("ScriptObjects/AI_PresetsSave"); } trg = (AI_Controller)target; ReloadPreset(); GUILayout.Space(10); GUILayout.Label("SELECT GLOBAL AI PRESET", EditorStyles.boldLabel); trg._presetIndex = EditorGUILayout.Popup("", trg._presetIndex, _aiPresets); GUILayout.Label("TO CREATE A NEW AI PRESET OPEN 'AI/AI CONTROLLER WINDOW' IN TOP TOOLBAR", EditorStyles.boldLabel); GUILayout.Space(10); GUILayout.Label("AGENT IS: " + _aiState[trg._agentState], EditorStyles.boldLabel); if (trg._pointsList != null) { GUILayout.Label("AGENT TARGET: " + trg._pointsList._points[trg.pointIndex].name, EditorStyles.boldLabel); } }
private void Start() { _aiPresetsSave = Resources.Load <AI_PresetsSave>("ScriptObjects/AI_PresetsSave"); _agent = GetComponent <NavMeshAgent>(); //Check if agent can patrol if (_aiPresetsSave.agentPatrol[_presetIndex] == true) { patrolType = _aiPresetsSave.agentPatrolType[_presetIndex]; //get patrol type pointIndex = _pointsList.GetNearestPointIndex(transform.position); //get nearest point index } }
private void OnEnable() { presetsData = Resources.Load <AI_PresetsSave>("ScriptObjects/AI_PresetsSave"); ReloadPreset(); }