//sets the vip for the agent. VIPScript PickVIP(List <GameObject> VIPs) { int i = Random.Range(0, VIPs.Count); VIPScript chosenVip = VIPs[i].GetComponent <VIPScript>(); Controller.Agent_Clearance = chosenVip.gameObject.GetComponent <AgentControl>().Agent_Clearance; return(chosenVip); }
IEnumerator VIP_Track(float delay) { if (Protect_Client == null) { Protect_Client = PickVIP(GameController.GameManager.Target_Agents); } while (true) { yield return(new WaitForSeconds(delay)); FindVIP(); } }
//The bodyguards role is to remain within the nearby vicinity of their allocated VIP or to safely escort the VIP around the map/protect them from the player. //Bodyguards must also be able to designate safe spaces to hide the vip or attempt to escort the vip out of the map. //currently, vip's are just normal civillians and will wonder around the map and go to specific locations on chance. VIP's also have master level access and can go anywhere. //in the case a VIP doesnt have access to the entire map, we make sure the bodyguards clearance matches that of their VIP. // Start is called before the first frame update void Start() { Controller = GetComponent <AgentControl>(); //pick a vip. if (GameController.GameManager.Target_Agents.Count > 0) { Protect_Client = PickVIP(GameController.GameManager.Target_Agents); } min_Dist = Random.Range(2, 4); max_Dist = Random.Range(5, 7); //under normal circumstances, the bodyguard should update their knowledge of the vips whereabouts every so often. StartCoroutine(VIP_Track(7.0f)); }