Skip to content

Setting

HoangVanThu edited this page Jun 24, 2024 · 7 revisions

What

  • SoundController.cs is used to handle sound in game and configure sound settings through SoundConfig.asset.
  • VibrationController.cs is used to handle vibration in game and configure vibration settings through VibrationConfig.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.
  • Setting state can be changed by using observer through PlayerData.

Uses

  • 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 turn on/off vibration in setting:
Data.PlayerData.VibrationState = true;
// or
Data.PlayerData.VibrationState = false;
  • To play music:
SoundController.Instance.PlayBackground(SoundName.Introduction);
  • To play sound fx:
SoundController.Instance.PlayFx(SoundName.Shoot);
  • To vibrate:
VibrationController.Instance.HapticLight();
VibrationController.Instance.HapticMedium();
VibrationController.Instance.HapticHeavy();
Clone this wiki locally