Class SampleAudio
- Namespace
- TDMaker.Editor
- Assembly
- TDMaker.Editor.dll
Assigns the optional sample audio (Assets/TDMaker/Samples/Audio/Sfx/<key>.ogg and Music/<key>.ogg)
to sample cues by key. A missing file leaves its cue empty, so sample generation is deterministic with or without the audio.
The key tables are public so tests (and buyers copying the scheme) can check them.
public static class SampleAudio
- Inheritance
-
SampleAudio
- Inherited Members
Fields
BattleMusic
Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.
public const string BattleMusic = "music_battle"
Field Value
BigEnemySize
Enemies at least this large (view size) use the big death sound.
public const float BigEnemySize = 0.55
Field Value
DefeatMusic
Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.
public const string DefeatMusic = "music_defeat"
Field Value
GlobalCueKeys
Which global AudioCuePlayer.GlobalCues slot uses which sound key (slots not listed stay empty).
public static readonly KeyValuePair<string, string>[] GlobalCueKeys
Field Value
- KeyValuePair<string, string>[]
IntenseMusic
Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.
public const string IntenseMusic = "music_battle_intense"
Field Value
MechanicCueKeys
Which AudioCuePlayer.MechanicCues slot uses which sound key.
public static readonly KeyValuePair<string, string>[] MechanicCueKeys
Field Value
- KeyValuePair<string, string>[]
MenuMusic
Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.
public const string MenuMusic = "music_menu"
Field Value
MusicFolder
Folder of the sample music.
public const string MusicFolder = "Assets/TDMaker/Samples/Audio/Music"
Field Value
SfxFolder
Folder of the sample sound effects.
public const string SfxFolder = "Assets/TDMaker/Samples/Audio/Sfx"
Field Value
VictoryMusic
Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.
public const string VictoryMusic = "music_victory"
Field Value
Properties
Available
Whether the optional sample audio is in the project (at least one clip in SfxFolder or MusicFolder).
public static bool Available { get; }
Property Value
Methods
AllKeys()
Every key the sample mapping can use (sound effects and music).
public static List<string> AllKeys()
Returns
ApplyAssetCues(params string[])
Assigns cues to every sample asset found in dataFolders by type and id: tower attacks, projectile
impacts, enemy hits and deaths (small / big), soldier attacks and deaths, hero attacks and spell casts.
public static void ApplyAssetCues(params string[] dataFolders)
Parameters
dataFoldersstring[]
ApplyAssetCues(ScriptableObject)
Assigns the sample cues of one asset; returns whether the asset type has sample cues.
public static bool ApplyAssetCues(ScriptableObject asset)
Parameters
assetScriptableObject
Returns
ApplyLevelMusic(LevelAsset, float)
Sets a sample level's music: battle and intense loops (intense on the last and boss waves) and the stingers.
public static void ApplyLevelMusic(LevelAsset level, float volume = 0.8)
Parameters
levelLevelAssetvolumefloat
ApplyMenuMusic(MusicPlayer)
Sets the menu loop of a sample music player (empty when the file is missing).
public static void ApplyMenuMusic(MusicPlayer player)
Parameters
playerMusicPlayer
ApplyPlayerCues(AudioCuePlayer)
Fills the global and mechanic cues of a sample audio player.
public static void ApplyPlayerCues(AudioCuePlayer player)
Parameters
playerAudioCuePlayer
Assign(AudioCue, string, float, float, float, float)
Sets a cue to the sample clip key (or leaves it empty when the clip is missing) with the given playback
settings. Returns whether a clip was assigned.
public static bool Assign(AudioCue cue, string key, float volume = 1, float minInterval = 0.05, float pitchMin = 0.95, float pitchMax = 1.05)
Parameters
Returns
EnemyDeathKey(float)
Death sound of an enemy by its view size.
public static string EnemyDeathKey(float viewSize)
Parameters
viewSizefloat
Returns
HeroAttackKey(string)
Attack sound of a sample hero by template id.
public static string HeroAttackKey(string templateId)
Parameters
templateIdstring
Returns
Music(string)
The sample music track for key, or null when the file does not exist.
public static AudioClip Music(string key)
Parameters
keystring
Returns
- AudioClip
ProjectileImpactKey(string)
Impact sound of a sample projectile by asset name (null: none).
public static string ProjectileImpactKey(string assetName)
Parameters
assetNamestring
Returns
Sfx(string)
The sample sound effect for key, or null when the file does not exist.
public static AudioClip Sfx(string key)
Parameters
keystring
Returns
- AudioClip
SpellCastKey(string)
Cast sound of a sample spell by spell id (null: none).
public static string SpellCastKey(string spellId)
Parameters
spellIdstring
Returns
TowerAttackKey(string)
Attack sound of a sample tower by template id (null: none, for example barracks).
public static string TowerAttackKey(string templateId)
Parameters
templateIdstring