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

string

BigEnemySize

Enemies at least this large (view size) use the big death sound.

public const float BigEnemySize = 0.55

Field Value

float

DefeatMusic

Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.

public const string DefeatMusic = "music_defeat"

Field Value

string

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

string

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

string

MusicFolder

Folder of the sample music.

public const string MusicFolder = "Assets/TDMaker/Samples/Audio/Music"

Field Value

string

SfxFolder

Folder of the sample sound effects.

public const string SfxFolder = "Assets/TDMaker/Samples/Audio/Sfx"

Field Value

string

VictoryMusic

Music keys: menu loop, battle loop, intense loop, victory and defeat stingers.

public const string VictoryMusic = "music_victory"

Field Value

string

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

bool

Methods

AllKeys()

Every key the sample mapping can use (sound effects and music).

public static List<string> AllKeys()

Returns

List<string>

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

dataFolders string[]

ApplyAssetCues(ScriptableObject)

Assigns the sample cues of one asset; returns whether the asset type has sample cues.

public static bool ApplyAssetCues(ScriptableObject asset)

Parameters

asset ScriptableObject

Returns

bool

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

level LevelAsset
volume float

ApplyMenuMusic(MusicPlayer)

Sets the menu loop of a sample music player (empty when the file is missing).

public static void ApplyMenuMusic(MusicPlayer player)

Parameters

player MusicPlayer

ApplyPlayerCues(AudioCuePlayer)

Fills the global and mechanic cues of a sample audio player.

public static void ApplyPlayerCues(AudioCuePlayer player)

Parameters

player AudioCuePlayer

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

cue AudioCue
key string
volume float
minInterval float
pitchMin float
pitchMax float

Returns

bool

EnemyDeathKey(float)

Death sound of an enemy by its view size.

public static string EnemyDeathKey(float viewSize)

Parameters

viewSize float

Returns

string

HeroAttackKey(string)

Attack sound of a sample hero by template id.

public static string HeroAttackKey(string templateId)

Parameters

templateId string

Returns

string

Music(string)

The sample music track for key, or null when the file does not exist.

public static AudioClip Music(string key)

Parameters

key string

Returns

AudioClip

ProjectileImpactKey(string)

Impact sound of a sample projectile by asset name (null: none).

public static string ProjectileImpactKey(string assetName)

Parameters

assetName string

Returns

string

Sfx(string)

The sample sound effect for key, or null when the file does not exist.

public static AudioClip Sfx(string key)

Parameters

key string

Returns

AudioClip

SpellCastKey(string)

Cast sound of a sample spell by spell id (null: none).

public static string SpellCastKey(string spellId)

Parameters

spellId string

Returns

string

TowerAttackKey(string)

Attack sound of a sample tower by template id (null: none, for example barracks).

public static string TowerAttackKey(string templateId)

Parameters

templateId string

Returns

string