Ryle Radio 1.0.0
An open-source "radio" system for Unity, allowing tracks, tuning, broadcasters, and more!
Loading...
Searching...
No Matches
RyleRadio.Components.RadioInsulator Class Reference

An "insulator" for a RadioTrackWrapper - if a RadioOutput is inside the bounds of this object, the affected tracks on it will become quieter. More...

Inheritance diagram for RyleRadio.Components.RadioInsulator:

Public Member Functions

float GetPower (Vector3 _position)
 Gets the power of this insulator at a specific 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

Vector3 innerBoxSize = Vector3.one * 0.9f
 The size of the inner box of the insulator- inside of this box, insulation is the highest.
Vector3 outerBoxSize = Vector3.one
 The size of the outer box of the insulator- outside of this box, insulation is 0- between this and the inner box, insulation is between [0 - 1].

Protected Member Functions

override void AssignToTrack (RadioTrackWrapper _track)
 Links this insulator to a track.
override void RemoveFromTrack (RadioTrackWrapper _track)
 Unlinks this insulator 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.

Properties

Vector3 InnerBoxSizeAdjusted [get, private set]
 The innerBoxSize but adjusted with transform.localScale in Update()
Vector3 OuterBoxSizeAdjusted [get, private set]
 The outerBoxSize but adjusted with transform.localScale in Update()
bool ShowApplyToAllOutputs [get]
 Shows applyToAllOutputsOutside when the x-value of insulation 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< RadioComponentOnInit = 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 cached position and adjusted box sizes.

Private Attributes

Vector2 insulation = new(0, 0.5f)
 The max and min insulation in the outer and inner boxes.
AnimationCurve insulationCurve = AnimationCurve.Linear(0, 0, 1, 1)
 A curve that defines insulation between the inner and outer boxes- the x-value is how far between the inner and outer boxes the output is.
bool applyToAllOutputsOutside = false
 Effectively makes this insulator global- when this is true, any output outside of the outer box's range will be affected by the x-value on insulation.
Vector3 cachedPos
 The position of the insulator in the previous frame. We cannot access transform.position in the audio thread, so we cache it to this.

Additional Inherited Members

Protected Attributes inherited from RyleRadio.Components.Base.RadioComponent
RadioData data
 The RadioData (aka just radio) that this component is linked to.

Detailed Description

An "insulator" for a RadioTrackWrapper - if a RadioOutput is inside the bounds of this object, the affected tracks on it will become quieter.

There aren't really any real-world analogues for the strength of an insulator like this- think of it like putting a radio in a Faraday cage or something I suppose

This also has custom editor stuff in RadioInsulatorEditor

Definition at line 17 of file RadioInsulator.cs.

Member Function Documentation

◆ AssignToTrack()

override void RyleRadio.Components.RadioInsulator.AssignToTrack ( RadioTrackWrapper _track)
protected

Links this insulator to a track.

Parameters
_trackThe track to link to

Definition at line 91 of file RadioInsulator.cs.

◆ GetPower()

float RyleRadio.Components.RadioInsulator.GetPower ( Vector3 _position)

Gets the power of this insulator at a specific position.

Parameters
_positionThe position to evaluate with
Returns
The insulation multiplier at the position. The lower the number, the stronger the insulation- it's a multiplier intended to shrink the samples rather than grow them

Definition at line 112 of file RadioInsulator.cs.

Referenced by RyleRadio.Tracks.RadioTrackPlayer.GetInsulation().

◆ RemoveFromTrack()

override void RyleRadio.Components.RadioInsulator.RemoveFromTrack ( RadioTrackWrapper _track)
protected

Unlinks this insulator from a track.

Parameters
_trackThe track to unlink from

Definition at line 101 of file RadioInsulator.cs.

◆ Update()

void RyleRadio.Components.RadioInsulator.Update ( )
private

Updates cached position and adjusted box sizes.

Definition at line 77 of file RadioInsulator.cs.

Member Data Documentation

◆ applyToAllOutputsOutside

bool RyleRadio.Components.RadioInsulator.applyToAllOutputsOutside = false
private

Effectively makes this insulator global- when this is true, any output outside of the outer box's range will be affected by the x-value on insulation.

This only shows when the x-value of insulation is above 0

Definition at line 55 of file RadioInsulator.cs.

Referenced by GetPower().

◆ cachedPos

Vector3 RyleRadio.Components.RadioInsulator.cachedPos
private

The position of the insulator in the previous frame. We cannot access transform.position in the audio thread, so we cache it to this.

Definition at line 60 of file RadioInsulator.cs.

Referenced by GetPower(), and Update().

◆ innerBoxSize

Vector3 RyleRadio.Components.RadioInsulator.innerBoxSize = Vector3.one * 0.9f

The size of the inner box of the insulator- inside of this box, insulation is the highest.

Definition at line 23 of file RadioInsulator.cs.

Referenced by Update().

◆ insulation

Vector2 RyleRadio.Components.RadioInsulator.insulation = new(0, 0.5f)
private

The max and min insulation in the outer and inner boxes.

If an output is on the edge of the outer box, insulation will be the x-value here. If an output is inside the inner box, insulation will be the y-value. If an output is between the inner and outer boxes, it will be somewhere between the x and y values according to the insulationCurve

If the x-value is above 0, you might want to toggle applyToAllOutputsOutside so this becomes global

Definition at line 41 of file RadioInsulator.cs.

Referenced by GetPower().

◆ insulationCurve

AnimationCurve RyleRadio.Components.RadioInsulator.insulationCurve = AnimationCurve.Linear(0, 0, 1, 1)
private

A curve that defines insulation between the inner and outer boxes- the x-value is how far between the inner and outer boxes the output is.

Definition at line 47 of file RadioInsulator.cs.

Referenced by GetPower().

◆ outerBoxSize

Vector3 RyleRadio.Components.RadioInsulator.outerBoxSize = Vector3.one

The size of the outer box of the insulator- outside of this box, insulation is 0- between this and the inner box, insulation is between [0 - 1].

Definition at line 28 of file RadioInsulator.cs.

Referenced by Update().

Property Documentation

◆ InnerBoxSizeAdjusted

Vector3 RyleRadio.Components.RadioInsulator.InnerBoxSizeAdjusted
getprivate set

The innerBoxSize but adjusted with transform.localScale in Update()

Definition at line 64 of file RadioInsulator.cs.

Referenced by GetPower(), and Update().

◆ OuterBoxSizeAdjusted

Vector3 RyleRadio.Components.RadioInsulator.OuterBoxSizeAdjusted
getprivate set

The outerBoxSize but adjusted with transform.localScale in Update()

Definition at line 66 of file RadioInsulator.cs.

Referenced by GetPower(), and Update().

◆ ShowApplyToAllOutputs

bool RyleRadio.Components.RadioInsulator.ShowApplyToAllOutputs
getprivate

Shows applyToAllOutputsOutside when the x-value of insulation is greater than 0.

Definition at line 71 of file RadioInsulator.cs.

Referenced by GetPower().


The documentation for this class was generated from the following file: