void OnTriggerEnter(Collider col) { if ((this.gameObject.tag == "teamMLBomb" && col.gameObject.tag == "mlMonster") || (this.gameObject.tag == "teamGOAPBomb" && col.gameObject.tag == "goapMonster")) { if (attachedToGO == null) { Monster attachedToMonster = col.gameObject.GetComponentInChildren <Monster>(); if (attachedToMonster != null) { attachedToGO = col.gameObject; attachedToMonster.SetHasBomb(true); isPickedUp = true; //Rewarding Agent MLMonsterAgent mlAgent = attachedToGO.GetComponentInChildren <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.RewardAgentForPickingUpBomb(); } if (academy.fulfillObjectivesCurriculum && academy.activeCurriculumPhase.Equals((int)MonsterTrainerAcademy.TrainingPhasesFullfillObjectives.phasePickupBomb)) { academy.Done(); } } } } }
void changeAreaToTeamML() { if (!conqueredByTeamML) { Debug.Log(this.gameObject.tag + " changeAreaToTeamML"); conqueredByNone = false; conqueredByTeamML = true; conqueredByTeamGOAP = false; changeColorToTeamML(); masterAreaControl.NotifyAreaChanged(); //TODO really reward all? List <Monster> teamMMonsters = teamMLController.teamMonsterList; foreach (Monster mMonsterEntity in teamMMonsters) { if (!mMonsterEntity.gameObject.activeInHierarchy) { continue; } MLMonsterAgent mlAgent = mMonsterEntity.GetComponent <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.RewardAgentForConqueringArea(); } } if (academy.fulfillObjectivesCurriculum && academy.activeCurriculumPhase.Equals((int)MonsterTrainerAcademy.TrainingPhasesFullfillObjectives.phaseConquerOneArea)) { academy.Done(); } } }
public void DetonateBomb() { Debug.Log("Boom!"); isDetonated = true; //Rewarding Agent if (attachedToGO != null) { MLMonsterAgent mlAgent = attachedToGO.GetComponentInChildren <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.RewardAgentForDetonatingBomb(); } } }
public void DieAndRespawn() { MLMonsterAgent mlAgent = this.gameObject.GetComponentInParent <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.PunishAgentForDying(); } if (hasBomb) { GameObject attachedBomb = thisTeamControler.teamBomb; Bomb bombEntity = attachedBomb.GetComponent <Bomb>(); bombEntity.ResetBombMidGame(); hasBomb = false; } isAlive = false; this.gameObject.SetActive(false); Debug.Log("INACTIVE!"); Invoke("WaitForRespawnInvoke", gParameters.respawnTime); }
public void StartZoneMDetonates() { Debug.Log("Team GOAP wins the Game!"); bombTeamGOAP.DetonateBomb(); List <Monster> teamMMonsters = teamMLController.teamMonsterList; foreach (Monster mMonsterEntity in teamMMonsters) { if (!mMonsterEntity.gameObject.activeInHierarchy) { continue; } MLMonsterAgent mlAgent = mMonsterEntity.GetComponent <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.PunishAgentForLosing(); } } academy.Done(); }
public void ResetBombMidGame() { if (attachedToGO != null) { //Punishing Agent MLMonsterAgent mlAgent = attachedToGO.GetComponentInChildren <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.PunishAgentForLosingBomb(); } attachedToGO.GetComponentInChildren <Monster>().SetHasBomb(false); attachedToGO = null; } if (this.tag == "teamMLBomb") { if (!(masterAreaControllerInstance.areaNorth.conqueredByTeamML && masterAreaControllerInstance.areaSouth.conqueredByTeamML)) { this.gameObject.SetActive(false); } } else if (this.tag == "teamGOAPBomb") { if (!(masterAreaControllerInstance.areaNorth.conqueredByTeamGOAP && masterAreaControllerInstance.areaSouth.conqueredByTeamGOAP)) { this.gameObject.SetActive(false); } } bombRB.transform.position = startPos; isPickedUp = false; isDetonated = false; hasSpawned = false; }
public void StartZoneADetonates() { Debug.Log("Team ML wins the Game!"); bombTeamML.DetonateBomb(); //TODO reward all? List <Monster> teamMMonsters = teamMLController.teamMonsterList; foreach (Monster mMonsterEntity in teamMMonsters) { if (!mMonsterEntity.gameObject.activeInHierarchy) { continue; } MLMonsterAgent mlAgent = mMonsterEntity.GetComponent <MLMonsterAgent>(); if (mlAgent != null) { mlAgent.RewardAgentForWinning(); } } academy.Done(); }