Musica Ingame

This commit is contained in:
Gerard Gascón 2023-03-03 15:41:59 +01:00
parent 3d9aad6211
commit 39597cfdff
32 changed files with 866 additions and 283 deletions

View file

@ -1,7 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using MyBox;
using SimpleTools.AudioManager;
using UnityEngine;
using UnityEngine.UI;
@ -28,15 +30,54 @@ public class CanvasController : MonoBehaviour {
bool _abort;
public void AbortCoroutine() => _abort = true;
OrbTypes _currentType = OrbTypes.None;
void PlayEffectMusic() {
switch (_currentType) {
case OrbTypes.None:
AudioManager.instance.Play("intro");
break;
case OrbTypes.Blue:
AudioManager.instance.Play("azul");
break;
case OrbTypes.Red:
AudioManager.instance.Play("rojo");
break;
case OrbTypes.Purple:
AudioManager.instance.Play("ambos");
break;
case OrbTypes.InvertedControls:
AudioManager.instance.Play("invertido");
break;
case OrbTypes.HighGravity:
AudioManager.instance.Play("alta");
break;
case OrbTypes.LowGravity:
AudioManager.instance.Play("baja");
break;
case OrbTypes.DarkRoom:
AudioManager.instance.Play("oscuro");
break;
case OrbTypes.Freeze:
AudioManager.instance.Play("rojo");
break;
default:
throw new ArgumentOutOfRangeException();
}
}
IEnumerator Countdown() {
PlayEffectMusic();
for (int i = 0; i < 10; ++i) {
orb.sprite = orbCountdown[i];
yield return new WaitForSeconds(1f);
if (_abort) yield break;
}
_effectImage.sprite = effectSprites[(int)GameManager.instance.SelectRandomEffect() - 1];
_currentType = GameManager.instance.SelectRandomEffect();
_effectImage.sprite = effectSprites[(int)_currentType - 1];
effectTween.DORestart();
StartCoroutine(Countdown());
}