TopDown Engine  v4.1
MoreMountains.Tools.MMRadioReceiver Class Reference

A class used to receive level values from a MMRadioBroadcaster, and apply it to (almost) any value on any object More...

Inheritance diagram for MoreMountains.Tools.MMRadioReceiver:
MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

virtual void GenerateRandomLevelMultiplier ()
 
virtual void SetLevel (float newLevel)
 Sets the level on the receiver More...
 
virtual void StartListening ()
 Starts listening for events More...
 
virtual void StopListening ()
 Stops listening for events More...
 

Public Attributes

MMPropertyReceiver Receiver
 the receiver to write the level to More...
 
bool CanListen = true
 whether or not this receiver should listen to the channel More...
 
int Channel = 0
 the Channel to listen to (has to match the one on the MMRadioBroadcaster you're listening to) More...
 
bool RandomizeLevel = false
 whether or not to randomize the received level, this will generate at awake a random level multiplier, to apply to the level More...
 
float MinRandomLevelMultiplier = 0f
 if random, the min bound of the random multiplier More...
 
float MaxRandomLevelMultiplier = 1f
 if random, the max bound of the random multiplier More...
 

Protected Member Functions

virtual void Awake ()
 On Awake, starts listening and generates a random level multiplier if needed More...
 
virtual void OnRadioLevelEvent (int channel, float level)
 When getting a radio level event, we make sure it's the right channel, and apply it if needed More...
 
virtual void OnDestroy ()
 Stops listening to events on destroy More...
 

Protected Attributes

bool _listeningToEvents = false
 
float _randomLevelMultiplier = 1f
 
float _lastLevel
 

Detailed Description

A class used to receive level values from a MMRadioBroadcaster, and apply it to (almost) any value on any object

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMRadioReceiver.Awake ( )
protectedvirtual

On Awake, starts listening and generates a random level multiplier if needed

◆ GenerateRandomLevelMultiplier()

virtual void MoreMountains.Tools.MMRadioReceiver.GenerateRandomLevelMultiplier ( )
virtual

◆ OnDestroy()

virtual void MoreMountains.Tools.MMRadioReceiver.OnDestroy ( )
protectedvirtual

Stops listening to events on destroy

◆ OnRadioLevelEvent()

virtual void MoreMountains.Tools.MMRadioReceiver.OnRadioLevelEvent ( int  channel,
float  level 
)
protectedvirtual

When getting a radio level event, we make sure it's the right channel, and apply it if needed

Parameters
channel
level

◆ SetLevel()

virtual void MoreMountains.Tools.MMRadioReceiver.SetLevel ( float  newLevel)
virtual

Sets the level on the receiver

Parameters
newLevel

◆ StartListening()

virtual void MoreMountains.Tools.MMRadioReceiver.StartListening ( )
virtual

Starts listening for events

◆ StopListening()

virtual void MoreMountains.Tools.MMRadioReceiver.StopListening ( )
virtual

Stops listening for events

Member Data Documentation

◆ _lastLevel

float MoreMountains.Tools.MMRadioReceiver._lastLevel
protected

◆ _listeningToEvents

bool MoreMountains.Tools.MMRadioReceiver._listeningToEvents = false
protected

◆ _randomLevelMultiplier

float MoreMountains.Tools.MMRadioReceiver._randomLevelMultiplier = 1f
protected

◆ CanListen

bool MoreMountains.Tools.MMRadioReceiver.CanListen = true

whether or not this receiver should listen to the channel

◆ Channel

int MoreMountains.Tools.MMRadioReceiver.Channel = 0

the Channel to listen to (has to match the one on the MMRadioBroadcaster you're listening to)

◆ MaxRandomLevelMultiplier

float MoreMountains.Tools.MMRadioReceiver.MaxRandomLevelMultiplier = 1f

if random, the max bound of the random multiplier

◆ MinRandomLevelMultiplier

float MoreMountains.Tools.MMRadioReceiver.MinRandomLevelMultiplier = 0f

if random, the min bound of the random multiplier

◆ RandomizeLevel

bool MoreMountains.Tools.MMRadioReceiver.RandomizeLevel = false

whether or not to randomize the received level, this will generate at awake a random level multiplier, to apply to the level

◆ Receiver

MMPropertyReceiver MoreMountains.Tools.MMRadioReceiver.Receiver

the receiver to write the level to


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