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