1using NaughtyAttributes;
16 [AddComponentMenu(
"Ryle Radio/Radio Insulator")]
40 [SerializeField, MinMaxSlider(0, 1)]
46 [SerializeField, CurveRange(0, 0, 1, 1)]
54 [SerializeField, AllowNesting, ShowIf(
"ShowApplyToAllOutputs")]
121 if (innerBounds.Contains(_position))
125 else if (!outerBounds.Contains(_position))
135 Vector3 dir = (_position - outerBounds.center).normalized;
138 Vector3 scaledDir =
new Vector3(dir.x * outerBounds.size.x, dir.y * outerBounds.size.y, dir.z * outerBounds.size.z);
141 Ray ray =
new Ray(outerBounds.center, scaledDir);
144 innerBounds.IntersectRay(ray, out
float distance2);
145 outerBounds.IntersectRay(ray, out
float distance);
148 Vector3 closestOnInner = innerBounds.center + ray.direction.normalized * -distance2;
149 Vector3 closestOnOuter = outerBounds.center + ray.direction.normalized * -distance;
152 float outerInnerDistance = Vector3.Distance(closestOnOuter, closestOnInner);
155 float d = Vector3.Distance(_position, closestOnInner);
158 power = 1 - d / outerInnerDistance;
An extension of RadioComponent that accesses specific tracks on the stored RadioData.
An "insulator" for a RadioTrackWrapper - if a RadioOutput is inside the bounds of this object,...
bool ShowApplyToAllOutputs
Shows applyToAllOutputsOutside when the x-value of insulation is greater than 0.
override void RemoveFromTrack(RadioTrackWrapper _track)
Unlinks this insulator from a track.
float GetPower(Vector3 _position)
Gets the power of this insulator at a specific position.
bool applyToAllOutputsOutside
Effectively makes this insulator global- when this is true, any output outside of the outer box's ran...
Vector3 OuterBoxSizeAdjusted
The outerBoxSize but adjusted with transform.localScale in Update()
Vector3 outerBoxSize
The size of the outer box of the insulator- outside of this box, insulation is 0- between this and th...
Vector3 innerBoxSize
The size of the inner box of the insulator- inside of this box, insulation is the highest.
Vector2 insulation
The max and min insulation in the outer and inner boxes.
Vector3 InnerBoxSizeAdjusted
The innerBoxSize but adjusted with transform.localScale in Update()
override void AssignToTrack(RadioTrackWrapper _track)
Links this insulator to a track.
void Update()
Updates cached position and adjusted box sizes.
Vector3 cachedPos
The position of the insulator in the previous frame. We cannot access transform.position in the audio...
AnimationCurve insulationCurve
A curve that defines insulation between the inner and outer boxes- the x-value is how far between the...
A wrapper class for RadioTrack so that track types can be switched between in the inspector!...
Action< RadioInsulator, RadioTrackWrapper > OnRemoveInsulator
An event called when an insulator is removed from this track.
Action< RadioInsulator, RadioTrackWrapper > OnAddInsulator
An event called when an insulator is added to the track.
List< RadioInsulator > insulators
The insulators in the scene that have this track selected.
Base interfaces and classes for components, e.g: track accessors, output accessors.
Components to be placed on scene objects, e.g: Outputs, Broadcasters, Observers.
Tracks to be used on a radio- includes base classes.