Unity 2D Rogue Lesson 4 Add Music - jasonweibel/HyperStream-Unity GitHub Wiki

Hyperstream : Unity 2D Rogue - Lesson 4 - Add Music

  1. Open Loader Script in Visual Studio

  2. Uncomment Sound Manager variable, line 9.

  3. Uncomment if statement instanciating soundmanager.

  4. Open Enemy.cs script in Visual Studio

  5. Uncomment SoundManager.instance.RandomizeSfx (attackSound1, attackSound2) in the OnCantMove method, line 95.

  6. Open Player.cs script in Visual Studio.

  7. Uncomment SoundManager.instance.RandomizeSfx (moveSound1, moveSound2) in the AttemptMove method, line 149.

  8. In Player.cs script uncomment SoundManager.instance.RandomizeSfx (eatSound1, eatSound2) in the OnTriggerEnter2D method, line 198.

  9. In Player.cs script uncomment SoundManager.instance.RandomizeSfx (drinkSound1, drinkSound2) in the OnTriggerEnter2D method, line 214.

  10. In Player.cs script uncomment SoundManager.instance.PlaySingle (gameOverSound) and SoundManager.instance.musicSource.Stop() in the CheckIfGameOver method, 256 and 259.

![](attachments/35782823/35782815.png)  
  1. On Wall.cs script in Visual Studio

  2. Uncomment SoundManager.instance.RandomizeSfx (chopSound1, chopSound2) in method DamageWall, line 28.

![](attachments/35782823/35782816.png)  
  1. On Unity and select Main Camera.

  2. Select Loader (Script) on the Main Camera.

  3. Update the Sound Manager to use SoundManager Asset.

![](attachments/35782823/35782817.png)  

![](attachments/35782823/35782818.png)  

![](attachments/35782823/35782819.png)  

![](attachments/35782823/35782820.png)  

![](attachments/35782823/35782821.png)  
  1. Update the Loader (Script) properties
![](attachments/35782823/35782822.png)  

Attachments:

image2017-9-18_12-37-59.png (image/png)
image2017-9-18_12-38-16.png (image/png)
image2017-9-18_12-38-37.png (image/png)
image2017-9-18_12-39-15.png (image/png)
image2017-9-18_12-39-34.png (image/png)
image2017-9-18_12-39-53.png (image/png)
image2017-9-18_12-40-12.png (image/png)
image2017-9-18_12-40-35.png (image/png)
image2017-9-18_12-41-9.png (image/png)
image2017-9-18_12-41-27.png (image/png)
image2017-9-18_12-41-55.png (image/png)
image2017-9-18_12-42-8.png (image/png)
image2017-9-18_12-42-22.png (image/png)
image2017-9-18_12-42-46.png (image/png)