Archivo inicial.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class EndSceneManager : MonoBehaviour
|
||||
{
|
||||
|
||||
/*public int rescatados;
|
||||
public int detenidos;
|
||||
public int huidos;
|
||||
public int muertos;
|
||||
float musicVol;
|
||||
float effectsVol;
|
||||
public float gameTime;*/
|
||||
|
||||
public AudioSource music;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
TMPro.TMP_Text rescatadosText = null;
|
||||
[SerializeField]
|
||||
TMPro.TMP_Text muertosText = null;
|
||||
[SerializeField]
|
||||
TMPro.TMP_Text capturadosText = null;
|
||||
[SerializeField]
|
||||
TMPro.TMP_Text huidosText = null;
|
||||
[SerializeField]
|
||||
TMPro.TMP_Text timeText = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
music.volume = DataSave.musicVol;
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
|
||||
public void BackToMenuButton()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(0, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
private void UpdateTexts()
|
||||
{
|
||||
rescatadosText.text += DataSave.rescatados;
|
||||
muertosText.text += DataSave.muertos;
|
||||
capturadosText.text += DataSave.detenidos;
|
||||
huidosText.text += DataSave.huidos;
|
||||
|
||||
timeText.text += Mathf.Round(DataSave.gameTime) + "s";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 007f21bbb64e03746aee5204a9c97835
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class GameUIManager : MonoBehaviour
|
||||
{
|
||||
GameManager GM;
|
||||
|
||||
|
||||
[Header("GUI")]
|
||||
public GameObject startMenu;
|
||||
public GameObject inGameMenu;
|
||||
public GameObject OverlayPanel;
|
||||
|
||||
[Header("HelpPanels")]
|
||||
public GameObject Panel1;
|
||||
public GameObject Panel2;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GM = GameObject.FindGameObjectWithTag("GM").GetComponent<GameManager>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartingUI();
|
||||
}
|
||||
|
||||
|
||||
public void NextWindowButton()
|
||||
{
|
||||
Panel1.SetActive(false);
|
||||
Panel2.SetActive(true);
|
||||
}
|
||||
|
||||
public void PreviousWindowButton()
|
||||
{
|
||||
Panel1.SetActive(true);
|
||||
Panel2.SetActive(false);
|
||||
}
|
||||
|
||||
public void StartButton()
|
||||
{
|
||||
GM.StartGame();
|
||||
}
|
||||
|
||||
public void BackMenuButton()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(0, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region UI States
|
||||
|
||||
public void StartingUI()
|
||||
{
|
||||
startMenu.SetActive(true);
|
||||
OverlayPanel.SetActive(false);
|
||||
inGameMenu.SetActive(false);
|
||||
|
||||
Panel1.SetActive(true);
|
||||
Panel2.SetActive(false);
|
||||
}
|
||||
|
||||
public void InGameUI()
|
||||
{
|
||||
startMenu.SetActive(false);
|
||||
OverlayPanel.SetActive(true);
|
||||
inGameMenu.SetActive(true);
|
||||
}
|
||||
|
||||
public void EndGameUI()
|
||||
{
|
||||
startMenu.SetActive(false);
|
||||
inGameMenu.SetActive(false);
|
||||
OverlayPanel.SetActive(false);
|
||||
SceneManager.LoadSceneAsync(2, LoadSceneMode.Single);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4d3892194eac024d94d8fd2f5fd54a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class MainMenuManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject MenuPanel;
|
||||
public GameObject SettingsPanel;
|
||||
|
||||
|
||||
|
||||
public AudioSource musicSource;
|
||||
public AudioSource effectsSource;
|
||||
|
||||
public Slider volMusicSlider;
|
||||
public Slider volEffectSlider;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
MenuPanel.SetActive(true);
|
||||
SettingsPanel.SetActive(false);
|
||||
|
||||
musicSource.Play();
|
||||
|
||||
effectsSource.volume = 0.5f;
|
||||
musicSource.volume = 0.5f;
|
||||
}
|
||||
|
||||
public void PlayButton()
|
||||
{
|
||||
StartCoroutine("PlayButtonRoutine");
|
||||
}
|
||||
|
||||
public void SetMusicVol()
|
||||
{
|
||||
DataSave.musicVol = volMusicSlider.value;
|
||||
musicSource.volume = volMusicSlider.value;
|
||||
}
|
||||
|
||||
public void SetEffectsVol()
|
||||
{
|
||||
DataSave.effectsVol = volEffectSlider.value;
|
||||
effectsSource.volume = volEffectSlider.value;
|
||||
}
|
||||
|
||||
|
||||
IEnumerator PlayButtonRoutine()
|
||||
{
|
||||
for(int i = 255; i > 0; i -= 3)
|
||||
{
|
||||
Debug.Log("For Start");
|
||||
MenuPanel.GetComponent<Image>().color = new Color(0, 0, 0, i/255f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
Debug.Log("Scene");
|
||||
SceneManager.LoadSceneAsync(1, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93579bb7a8d5cc1499502d99c56452d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user