Ryle Radio
1.0.1
An open-source "radio" system for Unity, allowing tracks, tuning, broadcasters, and more!
Loading...
Searching...
No Matches
RadioComponent.cs
1
using
UnityEngine;
2
3
namespace
RyleRadio.Components.Base
4
{
5
6
/// <summary>
7
/// A scene component that holds a reference to a \ref RadioData
8
/// </summary>
9
public
abstract
class
RadioComponent
: MonoBehaviour
10
{
11
/// <summary>
12
/// The \ref RadioData (aka just radio) that this component is linked to
13
/// </summary>
14
[SerializeField]
protected
RadioData
data
;
15
16
/// <summary>
17
/// Read-only accessor for \ref data
18
/// </summary>
19
public
RadioData
Data
=>
data
;
20
21
22
/// <summary>
23
/// Initialises this component
24
/// </summary>
25
public
abstract
void
Init
();
26
27
28
/// <summary>
29
/// Link \ref Init() to the radio's init
30
/// </summary>
31
private
void
Awake
()
32
{
33
data.OnInit += _ =>
Init
();
34
}
35
36
/// <summary>
37
/// Unlink \ref Init() from the radio's init
38
/// </summary>
39
private
void
OnDestroy
()
40
{
41
data.OnInit -= _ =>
Init
();
42
}
43
}
44
45
}
RyleRadio.Components.Base.RadioComponent
A scene component that holds a reference to a RadioData.
Definition
RadioComponent.cs:10
RyleRadio.Components.Base.RadioComponent.Data
RadioData Data
Read-only accessor for data.
Definition
RadioComponent.cs:19
RyleRadio.Components.Base.RadioComponent.OnDestroy
void OnDestroy()
Unlink Init() from the radio's init.
Definition
RadioComponent.cs:39
RyleRadio.Components.Base.RadioComponent.Awake
void Awake()
Link Init() to the radio's init.
Definition
RadioComponent.cs:31
RyleRadio.Components.Base.RadioComponent.Init
void Init()
Initialises this component.
RyleRadio.Components.Base.RadioComponent.data
RadioData data
The RadioData (aka just radio) that this component is linked to.
Definition
RadioComponent.cs:14
RyleRadio.RadioData
The central data object defining the radio. Contains the tracks and information required to play the ...
Definition
RadioData.cs:17
RyleRadio.Components.Base
Base interfaces and classes for components, e.g: track accessors, output accessors.
Definition
RadioComponent.cs:4
Runtime
Components
Base
RadioComponent.cs
Generated by
1.14.0