Skip to content

Setting

HoangVanThu edited this page Jun 18, 2024 · 7 revisions

What

  • SoundController.cs is used to handle sound in game and configure sound settings through SoundConfig.asset .
  • There are 2 types of sounds:
    • Background music: this is the sound of long music segments played continuously or repeated during gameplay.
    • Effect sound: this is the sound for effects. It's usually short and played when there is an interaction or effect happening in the game.

Usages

  • To turn on/off music in setting:
Data.PlayerData.MusicState = true;
// or
Data.PlayerData.MusicState = false;
  • To turn on/off sound in setting:
Data.PlayerData.SoundState = true;
// or
Data.PlayerData.SoundState = false;
  • To play music:
SoundController.Instance.PlayBackground(SoundName.Introduction);
  • To play sound fx:
SoundController.Instance.PlayFx(SoundName.Shoot);
Clone this wiki locally