private void OnTriggerExit(Collider other) { PerceptionTarget component = other.GetComponent <PerceptionTarget>(); if (component == null || this.perception == null) { return; } Transform host = component.host; if (this.perception.targetsCanBePercept.ContainsKey(host)) { this.perception.targetsCanBePercept[host].Remove(component); if (this.perception.targetsCanBePercept[host].Count < 1) { this.perception.hostsCanBeListened.Remove(host); this.perception.hostsCanBeSeen.Remove(host); this.perception.targetsCanBePercept.Remove(host); if (this.perception.OnBeNotSeenEvent != null) { this.perception.OnBeNotSeenEvent(host); } this.perception.SendMessageToUScript(host, false); } } }
private void OnTriggerEnter(Collider other) { PerceptionTarget component = other.GetComponent <PerceptionTarget>(); if (component == null || this.perception == null) { return; } Transform host = component.host; if (!this.perception.targetsCanBePercept.ContainsKey(host)) { List <PerceptionTarget> list = new List <PerceptionTarget>(); list.Add(component); this.perception.targetsCanBePercept.Add(host, list); } else { this.perception.targetsCanBePercept[component.host].Add(component); } }
private bool IsCanSeen(PerceptionTarget pt) { bool flag = false; pt.host.gameObject.GetModelObj(false); Vector3 direction = Vector3.zero; if (!flag) { direction = pt.transform.position - this.myTransform.position; if (this.useShowLog) { RaycastHit raycastHit; flag = !Physics.Raycast(this.myTransform.position, direction, out raycastHit, direction.magnitude, this.IgnoreMask); } else if (!Physics.Raycast(this.myTransform.position, direction, direction.magnitude, this.IgnoreMask)) { flag = true; } } return(flag); }