void PlaySoundEffect(AudioClip clip) { SE se = null; // SE待機配列より待機中を取得 for (int i = 0; i < this.standbySEs.Length; i++) { if (this.standbySEs[i] != null) { se = this.standbySEs[i]; this.standbySEs[i] = null; break; } } // 待機中が無ければ再生しない if (se == null) { return; } // 再生し、SE再生配列に追加 se.Play(clip); for (int i = 0; i < this.playingSEs.Length; i++) { if (this.playingSEs[i] == null) { this.playingSEs[i] = se; break; } } }
void EndPlaySoundEffect(SE se) { // SE再生配列より削除 for (int i = 0; i < this.playingSEs.Length; i++) { if (this.playingSEs[i] == se) { this.playingSEs[i] = null; break; } } // SE待機配列に追加 for (int i = 0; i < this.standbySEs.Length; i++) { if (this.standbySEs[i] == null) { this.standbySEs[i] = se; break; } } }
public static void EndPlaySE(SE se) { Instance.EndPlaySoundEffect(se); }