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

@ -63,7 +63,6 @@ public class GameManager : MonoBehaviour {
if (!_doorOpened) {
_doorOpened = true;
AudioManager.instance.Play("Puerta");
AudioManager.instance.FadeOut("Puerta", 1f);
doorOpenEvent.Invoke();
}
if (CurrentTime >= time && !_dead) {

View file

@ -31,7 +31,7 @@ public class MovingPlatform : MonoBehaviour {
yield return new WaitForFixedUpdate();
transform.position = Vector3.MoveTowards(transform.position, _end, _speed * Time.deltaTime);
if (Math.Abs(transform.position.sqrMagnitude - _end.sqrMagnitude) < 0.05f) {
if (((Vector2)transform.position - _end).sqrMagnitude < 0.05f) {
_swapRoutine ??= StartCoroutine(SwapCoordinates());
}
}

View file

@ -7,7 +7,7 @@ using UnityEngine;
public class SceneLoad : MonoBehaviour{
public void LoadScene(int sceneIndex) {
AudioManager.instance.FadeOut("Viento", 1f);
AudioManager.instance.StopAll();
Loader.Load(sceneIndex);
}
}

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());
}