private void UpdateSources(AreaEmitter.Polygon boundary) { this.sources.Sort(this.compareSources); int i = 0; while (i < this.sources.Count) { AreaEmitter.Source source = this.sources[i]; if (source.polygon != boundary) { AreaEmitter.StopSource(source); this.sources.RemoveAt(i); } else { int num = boundary.DescendToClosestSegment(source.segment); if (boundary.IsSegmentOccluded(num)) { num = boundary.AscendToAudibleSegment(source.segment); } if (!boundary.IsSegmentOccluded(num)) { source.segment = num; } AreaEmitter.Segment segment = boundary.GetSegment(source.segment); if (boundary.IsSegmentOccluded(source.segment) || segment.sqrDistance > this.sqrEventMaximumDistance) { AreaEmitter.StopSource(source); this.sources.RemoveAt(i); } else { Vector3 vector = segment.closestPoint - source.position; float sqrMagnitude = vector.sqrMagnitude; float num2 = this.sourceSpeed * Time.deltaTime; if (num2 * num2 >= sqrMagnitude) { source.position = segment.closestPoint; } else { source.position += vector.normalized * num2; } this.UpdateSource(source); this.sources[i] = source; i++; } } } while (this.sources.Count < this.maximumSourceCount) { int num3 = boundary.FindClosestAudibleSegment(); if (num3 < 0) { break; } this.CreateSource(boundary, num3); } }
private void OccludeSegments(AreaEmitter.Source occluder) { if (this.voids.Count == 0 && !this.perimeter.HasActiveSegments()) { return; } Vector3 closestPoint = occluder.polygon.GetSegment(occluder.segment).closestPoint; Vector3 v = closestPoint - LocalPlayer.Transform.position; float sqrMagnitude = v.sqrMagnitude; v.y = 0f; float num = -45f; Vector3 rightOfLeft = v.RotateY(num); Vector3 leftOfRight = v.RotateY(-num); for (int i = -1; i < this.voids.Count; i++) { this.GetPolygon(i).OccludeSegments(sqrMagnitude, rightOfLeft, leftOfRight); } }
private static void StopSource(AreaEmitter.Source source) { UnityUtil.ERRCHECK(source.eventInstance.stop(STOP_MODE.ALLOWFADEOUT)); UnityUtil.ERRCHECK(source.eventInstance.release()); }
private void UpdateSource(AreaEmitter.Source source) { this.OccludeSegments(source); this.UpdateEvent(source.eventInstance, source.position); }