Class MusicPlayer
- Namespace
- SurvivorsMaker.Presentation
- Assembly
- SurvivorsMaker.Presentation.dll
Context music with crossfades: menu, arena or field waves, shop / level-up and boss (while a boss is alive). The context follows a bound SurvivorsGame (Choose(bool, RunPhase, RunMode, bool, bool, bool)) unless Override is set. Volume = track × catalog music volume × the music option × ducking; the master option reaches it through the AudioListener. Runs on unscaled time so pausing does not freeze a fade.
public sealed class MusicPlayer : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourMusicPlayer
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Constructors
MusicPlayer()
public MusicPlayer()
Properties
Catalog
public SoundCatalogAsset Catalog { get; }
Property Value
Context
The context asked for this frame (before falling back to a context that has a track).
public MusicContext Context { get; }
Property Value
CurrentClip
The track now fading in or playing, or null for silence.
public AudioClip CurrentClip { get; }
Property Value
- AudioClip
DuckLevel
public float DuckLevel { get; }
Property Value
Override
public MusicContext Override { get; set; }
Property Value
Session
public SurvivorsGame Session { get; }
Property Value
Methods
Bind(SurvivorsGame)
public void Bind(SurvivorsGame game)
Parameters
gameSurvivorsGame
Configure(SoundCatalogAsset)
Changes the catalog. A playing track keeps playing when the new catalog uses the same clip.
public void Configure(SoundCatalogAsset value)
Parameters
valueSoundCatalogAsset
Duck(float)
Keeps the music ducked for at least seconds (scaled by the catalog's hold scale).
public void Duck(float seconds)
Parameters
secondsfloat
StopNow()
Stops both voices at once; the next frame fades the context's track in again while the component is enabled.
public void StopNow()