//if the AI does not have the flag it finds all tema mates and finds which ever one has the glag public bool ProtectTeamMate(Sensing sense, AgentData data, AgentActions actions) { List <GameObject> TeamMembers; TeamMembers = sense.GetFriendliesInView(); if (!data.HasEnemyFlag) { foreach (GameObject G in TeamMembers) { if (G.GetComponent <AgentData>().HasEnemyFlag) { actions.MoveTo(G); } } } return(true); }
// this is no longer used. // but what id does it checks all allies by the AI and then checks to see if any of them are carrying the flag // if they are then they will follow public void CheckTeamMates() { ResetAllGoals(); List <GameObject> TeamMembers; TeamMembers = _agentSenses.GetFriendliesInView(); foreach (GameObject G in TeamMembers) { if (G.GetComponent <AgentData>().HasEnemyFlag) { Debug.Log("Team Mate has flag"); TheAI.UpdateGoalValue(AIGoals.ProtectFriend, 5); TheAI.UpdateGoalValue(AIGoals.CaptureFlag, -10); Follow = true; } } //Follow = false; }