// Use this for initialization public virtual void Start() { // get the components on the object we need ( should not be null due to require component so no need to check ) agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); waypoints = GameObject.FindGameObjectsWithTag(wayPointString); RandomizeWayPointIndex(); pcCommunicationPartners = new List <GameObject>(); npcCommunicationPartners = new List <GameObject>(); vision = GetComponentInChildren <AIVisionNpc>(); AgentInitialization(); }
/// <summary> /// Removes visible NPCs from Collider. Must remove both: vision-Sphere and Capsule-Collider, because both make object visible /// </summary> /// <param name="gameObject">Game object.</param> public bool RemoveNPCFromColliders(GameObject goNPC) { Collider otherCollider = goNPC.GetComponent <Collider>(); RemoveFromCollider(otherCollider); AIVisionNpc vision = goNPC.GetComponentInChildren <AIVisionNpc>(); Collider visionCollider = vision.gameObject.GetComponent <Collider>(); RemoveFromCollider(visionCollider); return(true); }