HECHO EL GUARDADO SIIIIIIIIIIIII

Solo me falta para que vaya para cualquier nivel y no vaya solo para el primer nivel.
parent 974b8179
Showing with 66 additions and 19 deletions
......@@ -5,7 +5,10 @@ using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void PlayGame() {
public void NewGame() {
Coleccionables.iniciali = false;
Coleccionables.Modificado();
SceneManager.LoadScene("SampleScene");
}
......
......@@ -7,6 +7,14 @@ using UnityEngine.UI;
public class SeleccionNivel : MonoBehaviour
{
public Text infoColecc;
public Coleccionables GameManager;
private void Start()
{
GuardarYCargar.Cargar(GameManager, "slotColeccionables");
Coleccionables.CargarDatos();
Debug.Log("Cargando...");
}
void Update()
{
......
......@@ -2028,7 +2028,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 572894596}
m_MethodName: PlayGame
m_MethodName: NewGame
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
......
......@@ -485,6 +485,18 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c299a511f2a249142ac36667ddcf3b49, type: 3}
--- !u!114 &512889790 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3174322665456641310, guid: c299a511f2a249142ac36667ddcf3b49,
type: 3}
m_PrefabInstance: {fileID: 512889789}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 94ed2c62992ea584eb669871b1668a3c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &687002374
GameObject:
m_ObjectHideFlags: 0
......@@ -814,6 +826,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
infoColecc: {fileID: 2095981438}
GameManager: {fileID: 512889790}
--- !u!1 &1498000566
GameObject:
m_ObjectHideFlags: 0
......
......@@ -4,7 +4,7 @@ using UnityEngine;
public class Coleccionables : MonoBehaviour
{
public bool inicializado = false;
public bool inicializado = false; //NO TOCAR
public GameObject prefabColeccionable;
public bool NO_TOCAR_LAS_VARIABLES_DESDE_AQUI = true;
......@@ -29,6 +29,7 @@ public class Coleccionables : MonoBehaviour
public static Vector3[] pColecNivel1; //Si posicionesColecNivel1[i] = (0, 0, 0) ese coleccionable ya ha sido recogido
private static bool modificado = false; //Cada vez que modificas un dato de este script fuera tienes que llamar a su funcion
private static bool cargarDatos = false; //Cada vez que uses la funcion de GuardarYCargar.Cargar(); hay que usar esta despues.
// Start is called before the first frame update
void Awake()
......@@ -48,7 +49,7 @@ public class Coleccionables : MonoBehaviour
// {
enemigosTotales[0] = 2;
nombreImagenPartitura[0] = "Partitura-completa-1";
coleccTotales[0] = 5; //El ultimo coleccionable se consigue al derrotar a todos los enemigos
coleccTotales[0] = 5; //El ultimo coleccionable se consigue al derrotar a todos los enemigos, asi que aqui abajo hay el numero de coleccTotales - 1 de coleccionables
posicionesColecNivel1[0] = new Vector3(-5.48f, 0.01f, 0);
posicionesColecNivel1[1] = new Vector3(-3.08f, 0.01f, 0);
posicionesColecNivel1[2] = new Vector3(-1.78f, -1.78f, 0);
......@@ -84,9 +85,25 @@ public class Coleccionables : MonoBehaviour
void Update()
{
if (cargarDatos) {
cTotales = coleccTotales;
cConseguidos = colecConseguidos;
eTotales = enemigosTotales;
eDerrotados = enemigosDerrotados;
vMostrada = ventanaMostrada;
nIPartitura = nombreImagenPartitura;
pColecNivel1 = posicionesColecNivel1;
iniciali = inicializado;
cargarDatos = false;
}
if (modificado) {
coleccTotales = cTotales;
colecConseguidos = cConseguidos;
enemigosTotales = eTotales;
enemigosDerrotados = eDerrotados;
ventanaMostrada = vMostrada;
posicionesColecNivel1 = pColecNivel1;
......@@ -101,4 +118,8 @@ public class Coleccionables : MonoBehaviour
modificado = true;
}
public static void CargarDatos() {
cargarDatos = true;
}
}
......@@ -38,16 +38,18 @@ public class ZonaFinal : MonoBehaviour
Time.timeScale = 0;
if (Coleccionables.cConseguidos[0] == Coleccionables.cTotales[0])
if (!Coleccionables.vMostrada[0] && Coleccionables.cConseguidos[0] == Coleccionables.cTotales[0])
{
canvasColecionableDesbloqueados.gameObject.SetActive(true);
Sprite imagenPartitura = Resources.Load<Sprite>(Coleccionables.nIPartitura[0]);
SitioImagenPartitura.GetComponent<Image>().sprite = imagenPartitura;
Coleccionables.vMostrada[0] = true;
Coleccionables.Modificado();
}
else {
AbrirCanvasVictoria();
}
GuardarYCargar.Guardar(colecto, "slotColeccionables");
}
//Se abre al darle al boton siguiente desde el canvas "canvasColecionableDesbloqueados" o sino se han consguido todos los coleccionables
......
......@@ -21,7 +21,7 @@ MonoBehaviour:
m_ShowMode: 4
m_Title:
m_RootView: {fileID: 6}
m_MinSize: {x: 950, y: 300}
m_MinSize: {x: 950, y: 394}
m_MaxSize: {x: 10000, y: 10000}
--- !u!114 &2
MonoBehaviour:
......@@ -47,7 +47,7 @@ MonoBehaviour:
m_MinSize: {x: 681, y: 344}
m_MaxSize: {x: 12006, y: 8044}
vertical: 0
controlID: 132
controlID: 67
--- !u!114 &3
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -218,7 +218,7 @@ MonoBehaviour:
m_MinSize: {x: 406, y: 344}
m_MaxSize: {x: 8006, y: 8044}
vertical: 1
controlID: 58
controlID: 68
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -243,7 +243,7 @@ MonoBehaviour:
m_MinSize: {x: 406, y: 222}
m_MaxSize: {x: 8006, y: 4022}
vertical: 0
controlID: 59
controlID: 69
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -336,19 +336,19 @@ MonoBehaviour:
m_ShowAllHits: 0
m_SearchArea: 1
m_Folders:
- Assets/Prefabs
- Assets/Scenes
m_ViewMode: 1
m_StartGridSize: 64
m_LastFolders:
- Assets/Prefabs
- Assets/Scenes
m_LastFoldersGridSize: -1
m_LastProjectPath: C:\Users\Colme\Documents\UnityProjects\ProyectoVideojuegos\Videojuegos_Proyecto
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: de340000
m_LastClickedID: 13534
m_SelectedIDs: 162b0000
m_LastClickedID: 11030
m_ExpandedIDs: 000000004a2a000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
......@@ -377,7 +377,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 000000004a2a000056320000
m_ExpandedIDs: 000000004a2a0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -402,8 +402,8 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_SelectedInstanceIDs: c2320000
m_LastClickedInstanceID: 12994
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c6230000
m_RenameOverlay:
......@@ -499,7 +499,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: f09cffffc6a4fffff4a4fffffcadffff4aaeffff1eb6ffff42d7ffffd6dfffffb2e0ffff02eaffff1aeeffff8cfbffff24be0100
m_ExpandedIDs: 80e6feffaae6feff80effeff92effeffa2effeffd630ffff0031ffffd639ffffe839fffff839ffff3e4effff684effff4257ffff5857ffff6c57ffff108effffac8effffd6d1ffff8cfbffff9a3c0000c23c0000165900002e590000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment