public override bool checkProceduralPrecondition(GameObject agent) { if (goapActionControllerInstance == null) { goapActionControllerInstance = FindObjectOfType <GOAPActionController>(); } if (!goapActionControllerInstance.patrolRandomlyActionEnabled) { return(false); } waypoint = SpawnRandomWaypoint(); if (thisGoapMonsterAgent == null) { thisGoapMonsterAgent = GetComponent <GOAPMonsterAgent>(); } if (thisGoapMonsterAgent != null && waypoint != null) { thisGoapMonsterAgent.instantiatedWaypoints.Add(waypoint); } target = waypoint; return(waypoint != null); }
// Use this for initialization void Start() { navAgent = GetComponent <NavMeshAgent>(); goapActionControllerInstance = FindObjectOfType <GOAPActionController>(); }
public override void InitializeAcademy() { //TODO refactor! if (curriculumActive && brainToTrain != null && !debugModeWithPlayerBrain) { GameObject fulfillObjectiveBrainGameObject = GameObject.Find("FulfillObjectiveBrain"); Brain brainInstanceFulfillObjective = null; if (fulfillObjectiveBrainGameObject != null) { brainInstanceFulfillObjective = fulfillObjectiveBrainGameObject.GetComponent <Brain>(); } if (brainInstanceFulfillObjective != null) { brainInstanceFulfillObjective.brainType = BrainType.External; } GameObject attackEnemiesBrainGameObject = GameObject.Find("AttackEnemiesBrain"); Brain brainInstanceAttackEnemies = null; if (attackEnemiesBrainGameObject != null) { brainInstanceAttackEnemies = attackEnemiesBrainGameObject.GetComponent <Brain>(); } if (brainInstanceAttackEnemies != null) { brainInstanceAttackEnemies.brainType = BrainType.External; } } gameControllerInstance = FindObjectOfType <GameController>(); Debug.Log("gameControllerInstance" + gameControllerInstance); gameControllerInstance.initializeGame(); goapActionControllerInstance = FindObjectOfType <GOAPActionController>(); /* * GameObject teamMLControllerGameObject = GameObject.Find("TeamMLController"); * teamMLController = teamMLControllerGameObject.GetComponent<TeamController>(); * teamMLMonsterList = teamMLController.teamMonsterList; */ GameObject teamGOAPControllerGameObject = GameObject.Find("TeamGOAPController"); teamGOAPController = teamGOAPControllerGameObject.GetComponent <TeamController>(); teamGOAPMonsterList = teamGOAPController.teamMonsterList; if (curriculumActive) { Debug.Log("BrainToTrain: " + brainToTrain); if (brainToTrain != null) { fulfillObjectivesCurriculum = brainToTrain.name.Equals("FulfillObjectiveBrain"); attackEnemiesCurriculum = brainToTrain.name.Equals("AttackEnemiesBrain"); } if (fulfillObjectivesCurriculum) { activeCurriculumPhase = (int)resetParameters["phase_objectives_training"]; } else if (attackEnemiesCurriculum) { activeCurriculumPhase = (int)resetParameters["phase_attack_training"]; } /* * foreach (Monster monsterEntity in teamMLMonsterList) * { * Debug.Log("!monsterEntity.deactivatedAtStart " + !monsterEntity.deactivatedAtStart + " monsterEntity " + monsterEntity); * if (!monsterEntity.deactivatedAtStart) * { * MLMonsterAgent mlAgent = monsterEntity.GetComponent<MLMonsterAgent>(); * if (brainToTrain != null) * { * Debug.Log("mlAgent " + mlAgent + " gets Brain " + brainToTrain); * mlAgent.GiveBrain(brainToTrain); * } * } * } */ if (attackEnemiesCurriculum) { ActivateAttackEnemiesCurriculumPhase(activeCurriculumPhase); //TODO make sure all goapagents are active! } } }