![]() |
Ryle Radio 1.0.0
An open-source "radio" system for Unity, allowing tracks, tuning, broadcasters, and more!
|
A "broadcaster" for a RadioTrackWrapper - the closer the RadioOutput that's playing the track is to a broadcaster (taking into consideration broadcast radius, power, etc), the louder the track is in the Output. More...
Public Member Functions | |
| float | GetPower (Vector3 _receiverPos) |
| Gets the broadcast power of this particular broadcaster using the Output's position. | |
| Public Member Functions inherited from RyleRadio.Components.Base.RadioComponentDataAccessor | |
| override void | Init () |
| Initialises this component and links its affected tracks. | |
| Public Member Functions inherited from RyleRadio.Components.Base.RadioComponent | |
| void | Init () |
| Initialises this component. | |
Public Attributes | |
| Vector2 | broadcastRadius |
| The inner and outer radii of this broadcaster. | |
Protected Member Functions | |
| override void | AssignToTrack (RadioTrackWrapper _track) |
| Links this broadcaster to a track. | |
| override void | RemoveFromTrack (RadioTrackWrapper _track) |
| Unlinks this broadcaster from a track. | |
| Protected Member Functions inherited from RyleRadio.Components.Base.RadioComponentDataAccessor | |
| void | AssignToTrack (RadioTrackWrapper _track) |
| Links this component to a track. | |
| void | RemoveFromTrack (RadioTrackWrapper _track) |
| Unlinks this component from a track. | |
| virtual void | AccessorInit () |
| Allows extra code for initialization so that Init() can still be called. | |
Protected Attributes | |
| Vector2 | broadcastPowers = new(0, 1) |
| The power of this broadcaster at the maximum and minimum radii. | |
| AnimationCurve | distanceFalloff |
| The falloff curve between the inner and outer broadcast radii- the x-value is how far between the radii the Output is, and the y-value is how far between broadcastPowers x and y the track's broadcast power is. | |
| Protected Attributes inherited from RyleRadio.Components.Base.RadioComponent | |
| RadioData | data |
| The RadioData (aka just radio) that this component is linked to. | |
Properties | |
| bool | ShowApplyToAllOutputs [get] |
| Shows applyToAllOutputsOutside when the x-value of broadcastPowers is greater than 0. | |
| Properties inherited from RyleRadio.Components.Base.RadioComponentDataAccessor | |
| List< string > | TrackNames [get] |
| The list of tracks on the RadioData that this component can choose from. | |
| Action< RadioComponent > | OnInit = new(_ => { }) [get, set] |
| Event called when the component is initialized. | |
| Properties inherited from RyleRadio.Components.Base.RadioComponent | |
| RadioData | Data [get] |
| Read-only accessor for data. | |
Private Member Functions | |
| void | Update () |
| Updates the position of this broadcaster. | |
Private Attributes | |
| bool | applyToAllOutputsOutside = false |
| If the x-value of broadcastPowers should be applied to all Outputs outside of this broadcaster's radii- effectively makes it global. | |
| Vector3 | cachedPos |
| The position of the broadcaster in the previous frame- we can't access transform.position in the audio thread, so we need to cache it in update. | |
A "broadcaster" for a RadioTrackWrapper - the closer the RadioOutput that's playing the track is to a broadcaster (taking into consideration broadcast radius, power, etc), the louder the track is in the Output.
Somewhat similar to real world broadcasters- at least, that was the original intention :)
This has a custom editor in RadioBroadcasterEditor
Definition at line 17 of file RadioBroadcaster.cs.
|
protected |
Links this broadcaster to a track.
| _track | The track to link to |
Definition at line 80 of file RadioBroadcaster.cs.
| float RyleRadio.Components.RadioBroadcaster.GetPower | ( | Vector3 | _receiverPos | ) |
Gets the broadcast power of this particular broadcaster using the Output's position.
| _receiverPos | The position of the Output |
Definition at line 102 of file RadioBroadcaster.cs.
Referenced by RyleRadio.Tracks.RadioTrackPlayer.GetBroadcastPower().
|
protected |
Unlinks this broadcaster from a track.
| _track | The track to unlink from |
Definition at line 90 of file RadioBroadcaster.cs.
|
private |
Updates the position of this broadcaster.
Definition at line 70 of file RadioBroadcaster.cs.
|
private |
If the x-value of broadcastPowers should be applied to all Outputs outside of this broadcaster's radii- effectively makes it global.
Definition at line 54 of file RadioBroadcaster.cs.
Referenced by GetPower().
|
protected |
The power of this broadcaster at the maximum and minimum radii.
The x-value is the broadcast power right on the outer radius, and the y-value is the broadcast power within the inner radius. Broadcast power between the inner and outer radii will be somewhere in this range, defined by the distanceFalloff
If the x-value is greater than 0, you might want to enable applyToAllOutputsOutside so that all Outputs are affected by this broadcaster.
Definition at line 39 of file RadioBroadcaster.cs.
Referenced by GetPower().
| Vector2 RyleRadio.Components.RadioBroadcaster.broadcastRadius |
The inner and outer radii of this broadcaster.
radiusProg is the x-value in the distanceFalloff that we use to evaluate broadcast power If the Output is within the inner radius, the radiusProg is 1. If the Output is between the inner and outer radii, the radiusProg is between 0 and 1. If the Output is outside both radii, the radiusProg is 0.
Definition at line 28 of file RadioBroadcaster.cs.
Referenced by GetPower().
|
private |
The position of the broadcaster in the previous frame- we can't access transform.position in the audio thread, so we need to cache it in update.
Definition at line 59 of file RadioBroadcaster.cs.
Referenced by GetPower(), and Update().
|
protected |
The falloff curve between the inner and outer broadcast radii- the x-value is how far between the radii the Output is, and the y-value is how far between broadcastPowers x and y the track's broadcast power is.
Definition at line 45 of file RadioBroadcaster.cs.
Referenced by GetPower().
|
getprivate |
Shows applyToAllOutputsOutside when the x-value of broadcastPowers is greater than 0.
Definition at line 64 of file RadioBroadcaster.cs.
Referenced by GetPower().