Class CaveMusicTrack
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
Represent a dynamically composed track made out of individual small pieces of music mixed together defined by specific rules Requirements:
- Start/Stop Multiple Trackpieces
- Set their volumne dynamically
- Decide which Trackpieces to play
- Allow individual rules per Trackpiece Specific examples:
- Play Thunder ambient only if thunderlevel above 10
- Thunder ambient volume based on thunderlevel (between 0.3 and 1.1?)
- Play Aquatic Drone only when y below 60
- Play Deep Drone only when y below 50
[JsonObject(MemberSerialization.OptIn)]
public class CaveMusicTrack : IMusicTrack
- Inheritance
-
CaveMusicTrack
- Implements
- Inherited Members
- Extension Methods
Fields
ShouldPlayCaveMusic
public static bool ShouldPlayCaveMusic
Field Value
Properties
IsActive
Is the track active?
public bool IsActive { get; }
Property Value
Name
The name of the music track.
public string Name { get; }
Property Value
PositionString
public string PositionString { get; }
Property Value
StartPriority
The start priority of the track. A higher priority will leave active tracks playing.
public float StartPriority { get; }
Property Value
Methods
BeginPlay(TrackedPlayerProperties)
Starts playing the track.
public void BeginPlay(TrackedPlayerProperties props)
Parameters
props
TrackedPlayerPropertiesThe properties of the current track.
BeginSort()
Called before sorting by start priority happens
public void BeginSort()
ContinuePlay(float, TrackedPlayerProperties)
Do we continue playing this track?
public bool ContinuePlay(float dt, TrackedPlayerProperties props)
Parameters
dt
floatDelta time or Change in time
props
TrackedPlayerPropertiesThe properties of the current track.
Returns
- bool
Are we still playing or do we stop?
FadeOut(float, Action)
Fade out the track to end.
public void FadeOut(float seconds, Action onFadedOut = null)
Parameters
seconds
floatSeconds to fade out across.
onFadedOut
ActionDelegate to have happen once the fade-out is done.
FastForward(float)
public void FastForward(float seconds)
Parameters
seconds
float
Initialize(IAssetManager, ICoreClientAPI, IMusicEngine)
Initializes the music track
public void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)
Parameters
assetManager
IAssetManagerthe global Asset Manager
capi
ICoreClientAPIThe Core Client API
musicEngine
IMusicEngine
ShouldPlay(TrackedPlayerProperties, ClimateCondition, BlockPos)
Should the game play this track?
public bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos)
Parameters
props
TrackedPlayerPropertiesThe properties of the current track.
conds
ClimateConditionpos
BlockPos
Returns
- bool
Do we play this track?
UpdateVolume()
Updates the volume of the track.
public void UpdateVolume()