Skip to content

Commit

Permalink
sonido ajustes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeletzu committed May 25, 2024
1 parent 3f4321c commit 3d7d7ef
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 30 deletions.
4 changes: 2 additions & 2 deletions GodsTrials/Assets/Scenes/Cueva.unity
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ GameObject:
- component: {fileID: 122265581}
- component: {fileID: 122265583}
m_Layer: 0
m_Name: Audio Manager
m_Name: AudioManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -4350,7 +4350,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d6ff00a30f610564e88279a1cd279b5a, type: 3}
m_Name:
m_EditorClassIdentifier:
"da\xF1o": {fileID: 0}
dano: {fileID: 0}
dolor: {fileID: 0}
hercules: {fileID: 1675755597}
vida: 3
Expand Down
2 changes: 1 addition & 1 deletion GodsTrials/Assets/Scenes/Montaña.unity
Original file line number Diff line number Diff line change
Expand Up @@ -78533,7 +78533,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d6ff00a30f610564e88279a1cd279b5a, type: 3}
m_Name:
m_EditorClassIdentifier:
"da\xF1o": {fileID: 1174641680}
dano: {fileID: 0}
dolor: {fileID: 8300000, guid: 30802f62299ac7e40aed01b993919546, type: 3}
hercules: {fileID: 1174641664}
vida: 3
Expand Down
4 changes: 2 additions & 2 deletions GodsTrials/Assets/Scripts/DanoFlechas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ private void Update()
{
time += Time.deltaTime;
}
private void OnTriggerEnter2D(Collider2D bola)//si lo que toca el objeto tiene vida system entonces te hace daño
private void OnTriggerEnter2D(Collider2D bola)//si lo que toca el objeto tiene vida system entonces te hace dano
{
vida = bola.gameObject.GetComponent<VidaSystem>();
if (vida != null)
{
vida.DañoCupido();
vida.DanoCupido();
Destroy(gameObject);
}

Expand Down
4 changes: 2 additions & 2 deletions GodsTrials/Assets/Scripts/DañoEnemigo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEngine;
using UnityEngine.Tilemaps;

public class DañoEnemigo : MonoBehaviour
public class DanoEnemigo : MonoBehaviour
{
#region parametros
private VidaSystem vida;
Expand All @@ -30,7 +30,7 @@ private void OnTriggerEnter2D(Collider2D bola)//como danoflechas pero para los e
vida = bola.gameObject.GetComponent<VidaSystem>();
if (vida != null)
{
vida.Daño();
vida.Dano();
//animator.SetInteger("bola", 1);
sonido.RocaRota();
Destroy(gameObject);
Expand Down
6 changes: 3 additions & 3 deletions GodsTrials/Assets/Scripts/DañoTrampas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using System.Collections.Generic;
using UnityEngine;

public class DañoTrampas : MonoBehaviour
public class DanoTrampas : MonoBehaviour
{
private VidaSystem vida;
private void OnTriggerEnter2D(Collider2D collision)
{
vida = collision.gameObject.GetComponent<VidaSystem>();
if (vida != null)
{
vida.Daño();
vida.ImpulsoPorDaño();
vida.Dano();
vida.ImpulsoPorDano();
}
}
}
27 changes: 23 additions & 4 deletions GodsTrials/Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ public class GameManager : MonoBehaviour
public static GameManager Instance { get { return _instance; } }

private UIManager _UIManager;
private AudioSource _audio;
private StateManager _stateManager;
public int PuntosTotales { get { return puntosTotales; } }
private int puntosTotales;

[SerializeField]
private bool isMenu;
private bool isDead;
#endregion

#region methods
Expand All @@ -31,6 +33,15 @@ public void SumarMonedas(int puntosASumar)
Debug.Log(puntosTotales);
}

public void SetDead(bool b){
isDead = b;
if (b){
_audio.Stop();
}
else{
_audio.Play();
}
}

/// Initial setup of references and call to StartMenu
void Start()
Expand All @@ -41,15 +52,23 @@ void Start()

_stateManager = GetComponent<StateManager>();

_audio = GameObject.Find("AudioManager").GetComponent<AudioSource>();

isDead = false;
}

void Update()
{
if (Input.GetKeyDown(KeyCode.Escape) && !isMenu)
if (Input.GetKeyDown(KeyCode.Escape) && !isMenu && !isDead)
{
//Debug.Log("KeyDownESC");
_stateManager.ChangeGameState(SceneID.PauseMenu);
}
if (_stateManager.isPaused()) {
_audio.Play();
}
else {
_audio.Stop();
}
_stateManager.ChangeGameState(SceneID.PauseMenu);
}
}

/* private void Awake()
Expand Down
1 change: 1 addition & 0 deletions GodsTrials/Assets/Scripts/LevelChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class LevelChange : MonoBehaviour
public void Muerte()
{
dialogue.SetActive(false);
_gameManager.SetDead(true);
_gameManager.LevelChange(SceneID.Muerte);
}

Expand Down
9 changes: 5 additions & 4 deletions GodsTrials/Assets/Scripts/StateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public void ChangeGameState(SceneID id)
break;
case SceneID.PauseMenu:{
if (paused){
//Debug.Log("changing from PAUSED");
Debug.Log("changing from PAUSED");
paused = false;
Time.timeScale = 1f;
Unload(5);
Time.timeScale = 1;
}
else {
//Debug.Log("changing from NOT PAUSED");
Debug.Log("changing from NOT PAUSED");
paused = true;
Time.timeScale = 0f;
Load(5, true);
Time.timeScale = 0;
}
}
break;
Expand Down Expand Up @@ -128,6 +128,7 @@ private void Unload(int id)
if (id == 3)
{//si era la escena de muerte
Application.LoadLevel(Application.loadedLevel);
GameObject.Find("GameManager").GetComponent<GameManager>().SetDead(false);
}
}

Expand Down
1 change: 0 additions & 1 deletion GodsTrials/Assets/Scripts/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ void Update()
}
//si estamos en la escena del texto y presionamos enter nos lleva a la siguiente
if (SceneManager.GetActiveScene().buildIndex == 9 && Input.GetKeyDown(KeyCode.Return)){
Debug.Log("txao");
OnPress(16);
}
}
Expand Down
15 changes: 8 additions & 7 deletions GodsTrials/Assets/Scripts/VidaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class VidaSystem : MonoBehaviour
{
[SerializeField]
private AudioSource daño;
private AudioSource dano;
[SerializeField]
private AudioClip dolor;
private LevelChange morir;
Expand Down Expand Up @@ -68,12 +68,13 @@ public void MuerteCompleta()
{
Destroy(hercules);
barravida.DanoTotal();

morir.Muerte();

}
public void Daño()
public void Dano()
{
daño.PlayOneShot(dolor);
dano.PlayOneShot(dolor);
animatorController.Dano();
barravida.DanoTres();
vida--;
Expand All @@ -84,9 +85,9 @@ public void MuerteCompleta()
}
}

public void DañoCupido()//para los cupidos modificado por Jule
public void DanoCupido()//para los cupidos modificado por Jule
{
daño.PlayOneShot(dolor);
dano.PlayOneShot(dolor);
animatorController.Dano();
barravida.DanoSiete();
vida-=vidacupido;
Expand All @@ -99,7 +100,7 @@ public void MuerteCompleta()

public void DanoPiedra()//para los cupidos modificado por Jule
{
daño.PlayOneShot(dolor);
dano.PlayOneShot(dolor);
animatorController.Dano();
barravida.DanoDos();
vida -= vidapiedra;
Expand All @@ -109,7 +110,7 @@ public void DanoPiedra()//para los cupidos modificado por Jule
morir.Muerte();
}
}
public void ImpulsoPorDaño()
public void ImpulsoPorDano()
{
jugador.state = 1;
if (hercules.transform.rotation == Quaternion.identity)
Expand Down
8 changes: 4 additions & 4 deletions GodsTrials/Assets/Scripts/enemigopiedra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void Update()
audio.Play();
play = true;
}
else if(camdist >= 8)// si no lo está, para
else if(camdist >= 8)// si no lo est�, para
{
audio.Stop();
play = false;
Expand Down Expand Up @@ -85,10 +85,10 @@ void Update()
danoherculesderch = Physics2D.Raycast(transform.position, Vector3.right, 1.1f, hercules);
danoherculesizq = Physics2D.Raycast(transform.position, Vector3.left, 1f, hercules);

if (dano)// con raycast si lo toca el personaje hace daño y te mata
if (dano)// con raycast si lo toca el personaje hace daño y te mata
{
movimiento = false;
vidaSystem.ImpulsoPorDaño();
vidaSystem.ImpulsoPorDano();
animator.SetInteger("enemigopiedra", 1);
audio.Stop();
Destroy(audio);
Expand All @@ -98,7 +98,7 @@ void Update()
if (danoherculesderch || danoherculesizq)// quita vida
{
Debug.Log("Entra");
vidaSystem.ImpulsoPorDaño();
vidaSystem.ImpulsoPorDano();
vidaSystem.DanoPiedra();
}
}
Expand Down

0 comments on commit 3d7d7ef

Please sign in to comment.