<repo_name>Kindraman/Ku<file_sep>/Assets/Scripts/Game/Bow.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bow : MonoBehaviour {

	public GameObject arrowPrefab;
    //public Transform arrowPos;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void Attack(){
        var a = Instantiate (arrowPrefab);
		a.transform.position = transform.position + transform.forward;
		a.transform.rotation = transform.rotation;

	}
}
<file_sep>/Library/Collab/Download/Assets/loadGameManager.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class loadGameManager : MonoBehaviour {

    public GameObject[] partida;
    public SQLCommands bdein;
	// Use this for initialization
	void Start () {
        //establecer conexión a la base de datos y preguntar por todas las partidas (3 max)
        foreach(DbPartidas db in bdein.dbPartidas){
            Debug.Log("Something");
        }
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
<file_sep>/Assets/Scripts/Game/StrongEnemy.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StrongEnemy : Enemy {

	// Use this for initialization
	void Start () {
		health = 10;
		dmg = 2;
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public override void Hit ()
	{
		base.Hit ();
		this.health--;
		Debug.Log ("Ouch!");
		if (health <= 0) {
			Destroy (gameObject);
		}
	}
}
<file_sep>/Assets/Scripts/Game/SceneController.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;

public class SceneController : MonoBehaviour {


	[Header("Game")]
    public Player_FPS player;
    public GameObject gameMenu;
    public GameObject gameOver;

    [Header("UI")]
	public GameObject[] hearts;
	public Text arrowText;
	public Text bombText;
    public Text expText;

  

	// Use this for initialization
	void Start () {
        //gameMenu.SetActive(false);
       
          


        /* if (!player)
         {
             player = GameObject.FindWithTag("Player").GetComponent<Player_FPS>();
             if (GameObject.FindGameObjectWithTag("loadedData").GetComponent<DbPartidas>())
             { //si encuentra el objetop
               //Debug.Log("He podido encontrar la data guardada: " + data.nombrePartida);
               // player
                 player.loadData(GameObject.FindGameObjectWithTag("loadedData").GetComponent<DbPartidas>());

             }
         }
         else
         {
             if (GameObject.FindGameObjectWithTag("loadedData").GetComponent<DbPartidas>())
             { //si encuentra el objetop
               //Debug.Log("He podido encontrar la data guardada: " + data.nombrePartida);
               // player
                 player.loadData(GameObject.FindGameObjectWithTag("loadedData").GetComponent<DbPartidas>());

             }
         }*/





    }
	
	// Update is called once per frame
	void Update () {

		if(player != null){
			
			for(int i=0;i<hearts.Length;i++){
				hearts[i].SetActive(i<player.health);
			}

			arrowText.text = "Arrows: "+player.arrowAmount;
			bombText.text = "Bombs: "+player.bombAmount;
            expText.text = "EXP: " + player.exp;
		} else {
			for(int i=0;i<hearts.Length;i++){
				hearts[i].SetActive(false);
			}
		}
        if(player.health <= 0){
            gameOverOn();
        }
		
		
	}

    public void gameMenuOn(){
        gameMenu.SetActive(true);
    }

    public void gameMenuOff()
    {
        gameMenu.SetActive(false);
    }

    public void gameOverOn(){
        gameOver.SetActive(true);
    }
}
<file_sep>/Library/Collab/Download/Assets/Scripts/Menu/MenuSceneManager.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class MenuSceneManager : MonoBehaviour {

	// Use this for initialization
	public void newGame () {
		SceneManager.LoadScene("ZendaGame");
	}

    public void loadGame(){
        SceneManager.LoadScene("LoadGame");
    }

    public void mainMenu(){
        SceneManager.LoadScene("MainMenu");
    }

    public void testing(){
        Debug.Log("works");
    }
	
	
}
<file_sep>/Assets/Scripts/Db/dataManager.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class dataManager : MonoBehaviour
{
    protected DbPartidas dbp;

    public void setUp(){
        if (GameObject.FindGameObjectWithTag("loadedData"))
        { //esto va para el script padre loaderData
            dbp = GameObject.FindGameObjectWithTag("loadedData").GetComponent<DbPartidas>();
           // player.loadData(dbp); //no es el player el que carga sus datos si no el "loaderDataPlayer":loaderData
        }
    }

    public abstract void saveHelper();
    public abstract void loadHelper();
}
<file_sep>/Assets/Scripts/Game/Enemy.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour {

	protected int health;
	public int dmg;
	//public GameObject enemyWeakPoint;
	public virtual void Hit(){}

	public void OnTriggerEnter(Collider col){
		if (col.tag == "Sword") {
			if(col.GetComponent<Sword>() != null && col.GetComponent<Sword>().IsAttacking){
				Hit ();
			}
			
		} else if (col.tag == "Arrow") {
			Hit ();
			Destroy (col.gameObject);
		}

	}
}
<file_sep>/Assets/Scripts/Menu/SQLCommands.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using System.Data; //lib 1 BD
using System.IO; //lib 2 BD
using Mono.Data.Sqlite; //lib 3 BD
using System; //lib 4 BD (util)

public class SQLCommands : MonoBehaviour {

    string rutaDb;
    string strConexion;
    string DbFileName = "manu2.db";
    //string sqlQuery;

    IDbConnection dbConnection;
    IDbCommand dbCommand;
    IDataReader dataReader;

    //public DbPartidas[] dbPartidas;
    //public List<DbPartidas> dbPartidas;
    //public loaderGame lg;
    //IData

    //for this instance:
    private string col1 = "id", col2 = "nombrePartida", col3 = "statePlayer", col4 = "fecha";
    private string values = "";

    public void loadingGame(){
        abrirDb();

        simple_select("partidas", "*");
        //lg.UILogicOn();

        cerrarDb();

    }

    void Start()
    {

        //simple_select("partidas","*"); //(tableToSelect,item)
        // where("Camisas", "*", "marca","=" ,"SwingIt",true,"ASC","cantidad"); //(tableToSelect,item,column,value,isOrdered,orderType,orderCol)
        //insert("Camisas", "(7,'manunu','721EXP',1996)"); //(table,col1,...,col4,values) "(7,'manunu','721EXP',1996)"
        //updateBd("Camisas","7","12", "Manuelin", "900EXP", "25");//string table,string idRow, string val1, string val2, string val3, string val4
        //delete("Camisas", "12");
        //cerrarDb();
        //

    }

    private void abrirDb()
    {
        //1)Crear y abrir la conexión.
        rutaDb = Application.dataPath + "/Resources/Data/StreamingAssets/" + DbFileName;
        strConexion = "URI=file:" + rutaDb;
        dbConnection = new SqliteConnection(strConexion);
        dbConnection.Open();
    }

    private void simple_select(string table, string item)
    {
        //2)Crear la consulta
        dbCommand = dbConnection.CreateCommand();
        string sqlQuery = "select " + item + " from " + table;
        dbCommand.CommandText = sqlQuery;
        //string[] row;
        int i = 0;

        //3)Leer la Bd
        dataReader = dbCommand.ExecuteReader();

        //string suma = "";
        while (dataReader.Read())
        { //Mientras esté leyendo la BD

            //id
            int id = dataReader.GetInt32(0); //obtiene el dato tipo int de la casilla nº0 (columna)
            //marca
            string nombrePartida = dataReader.GetString(1);
            //color
            string statePlayer = dataReader.GetString(2);
            //cantidades
            string fecha = dataReader.GetString(3);

            //var dbp = new DbPartidas(id, nombrePartida, statePlayer, fecha);
            //DbPartidas dbp = lg.partidasBox[i].GetComponent<DbPartidas>();
            //dbp.construct(id,nombrePartida,statePlayer,fecha);
           // dbp.ready = true;
            if(i<2){
                Debug.Log(i);
                i++;

            }


            //dbp.debug();

            //string resume = id+":"+nombrePartida+":"+statePlayer+":"+fecha;


            //suma += id + "_" + nombrePartida + "_" + statePlayer + "_" + fecha+" -";
        }

        Debug.Log("i final es: " + i);

    }

    private void where(string table, string item, string col,string comparador, string val, bool isOrdered, string orderType, string orderItem ){
        //2)Crear la consulta
        int n;
        if(!int.TryParse(val, out n)){ //verdadero
            //no es numerica (es string)
            val = "'"+val+"'";
        } 
        dbCommand = dbConnection.CreateCommand();
        string sqlQuery = "select " + item + " from " + table + " where "+col+" "+comparador+" "+val;
        if(isOrdered){
            sqlQuery += " order by "+orderItem +" "+orderType;
             
        }
        dbCommand.CommandText = sqlQuery;

        //3)Leer la Bd
        dataReader = dbCommand.ExecuteReader();

        while (dataReader.Read())
        { //Mientras esté leyendo la BD

            //id
            int id = dataReader.GetInt32(0); //obtiene el dato tipo int de la casilla nº0 (columna)
            //marca
            string marca = dataReader.GetString(1);
            //color
            string color = dataReader.GetString(2);
            //cantidades
            //int cantidad = dataReader.GetInt32(3);

            Debug.Log(id + "-" + marca + "-" + color);


        }
    }

    private void insertBasic(string table){
        //values ya debe venir asi (val1,val2,val3,val4),.. (....)
        //este es un insert pensado en tablas de 4 columnas. (id,nombrePartida,EXPERIENCIA,fecha)
        //2)Crear la consulta
        dbCommand = dbConnection.CreateCommand();
        //values = "(7,'manunu','721EXP',1996)";
        string sqlQuery = "insert into " + table + "("+ col2 + "," + col3 + "," + col4+")" +" values " + this.values;
            
        dbCommand.CommandText = sqlQuery;
        dbCommand.ExecuteScalar();
        Debug.Log("Insert GOOOD");
        //cerrarDb();
    }

    private void updateBd(string table,string idRow, string val1, string val2, string val3, string val4)
    {
        //UPDATE table_name
        // SET column1 = value1, column2 = value2...., columnN = valueN
        // WHERE[condition];
        dbCommand = dbConnection.CreateCommand();
        //values = "(7,'manunu','721EXP',1996)";
        string sqlQuery = "update " + table +" set "+col1+" = "+val1+", "+col2+" = '"+val2+"', "+col3+" = '"+val3+"',"+col4+" = "+val4
            + " where "+ col1 +" = "+ idRow;
        dbCommand.CommandText = sqlQuery;
        dbCommand.ExecuteScalar();
        Debug.Log("update GOOOD");
    }

    private void delete(string table,string idRow){
        dbCommand = dbConnection.CreateCommand();
        //values = "(7,'manunu','721EXP',1996)";
        string sqlQuery = "delete from "+table+" where "+col1+" = "+idRow;
        dbCommand.CommandText = sqlQuery;
        dbCommand.ExecuteScalar();
        Debug.Log("delete GOOOD");
    }

    private void cerrarDb(){
        dataReader.Close();
        dataReader = null;
        dbCommand.Dispose();
        dbCommand = null;
        dbConnection.Close();
        dbConnection = null;
    }
    public void cerrarDb_ins(){
        dbCommand.Dispose();
        dbCommand = null;
        dbConnection.Close();
        dbConnection = null;
    }

    private void convertToValues(){
        DbPartidas dbp = GameObject.FindWithTag("loadedData").GetComponent<DbPartidas>();
        this.values = "('"+dbp.nombrePartida + "','" + dbp.playerState + "','" + dbp.fecha + "')";


    }

    public void inserter(){
        abrirDb();
        convertToValues();
        insertBasic("partidas");
        cerrarDb_ins();
    }

  }
<file_sep>/Assets/Scripts/Game/Arrow.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Arrow : Proyectile {

	
	void Start(){
		base.starting();
		dmg = 1;
	}

}
<file_sep>/Assets/Scripts/Db/dataManagerPartidaUI.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class dataManagerPartidaUI : dataManager {

    public GenericRepo repo; //aqui ocupa el generico!!!
    public GameObject[] partidasBox;

    void Start () {
       // setUp();
        repo.load();
    }

    public override void loadHelper()
    {
        //establecer conexión a la base de datos y preguntar por todas las partidas (3 max)
        for (int i = 0; i < 3; i++)
        {


            if (partidasBox[i].GetComponent<DbPartidas>().ready)
            {
                partidasBox[i].gameObject.SetActive(true);
                //Debug.Log(partidasBox.ToString());
                Debug.Log("Active Self: " + partidasBox[i].activeSelf);
                Debug.Log("Active in Hierarchy" + partidasBox[i].activeInHierarchy);
                partidasBox[i].GetComponentInChildren<Text>().text = partidasBox[i].GetComponent<DbPartidas>().infoPartida();
                Debug.Log("HIII entre aqui!");
            }
        }
    }

    public override void saveHelper()
    {
        throw new System.NotImplementedException();
    }


}
<file_sep>/Assets/Scripts/Db/dataManagerPlayer.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class dataManagerPlayer : dataManager {

    // Use this for initialization
    private Player_FPS player;
	void Start () {
        setUp();
        //loadData();
        player = GameObject.FindWithTag("Player").GetComponent<Player_FPS>();
        if(player){
            loadHelper();
        }
	}


    public override void loadHelper()//Carga los datos de la partida en player.
    {
        string[] subStrings = dbp.playerState.Split(':');
        player.transform.position = dbp.obtainPos(subStrings[0]);
        player.exp = int.Parse(subStrings[1]);
        player.health = int.Parse(subStrings[2]);
        player.bombAmount = int.Parse(subStrings[4]);
        player.arrowAmount = int.Parse(subStrings[3]);
        player.achievements = subStrings[5];


        //player.loadData(dbp); //no es el player el que carga sus datos si no el "loaderDataPlayer":loaderData
    }

    public override void saveHelper()
    {
        string state = player.transform.position.x + "," + player.transform.position.y + "," + player.transform.position.z + ":"
                           + player.exp + ":" + player.health + ":" + player.arrowAmount + ":" + player.bombAmount + ":" + "ninguno";
        dbp.playerState = state;
        dbp.nombrePartida = "Partida nº" + dbp.id;
        dbp.fecha = "10/09/2018";

        dbp.exp = player.exp;
        dbp.health = player.health;
        dbp.nArrows = player.arrowAmount;
        dbp.nBombs = player.bombAmount;
        dbp.achievements = player.achievements;
    }

    public void prepareSave(){
        if (!GameObject.FindWithTag("loadedData")) //si no hay partida cargada... se crea una "memoria"
        {
            GameObject obj = new GameObject();
            obj.tag = "loadedData";
            dbp = obj.AddComponent<DbPartidas>();

        }
        else
        {
            dbp = GameObject.FindWithTag("loadedData").GetComponent<DbPartidas>(); //si la hay se carga
        }

        saveHelper();
        // dbp.id = 1;


       
    }

}
<file_sep>/Assets/Plugins/ConexDB.cs
﻿using System.Collections;
using System.Collections.Generic;
using System.Data; //lib 1 BD
using System.IO; //lib 2 BD
using Mono.Data.Sqlite; //lib 3 BD
using System; //lib 4 BD (util)
using UnityEngine;

public class ConexDB : MonoBehaviour {

    string rutaDb;
    string strConexion;
    string DbFileName = "RopaMarianoDB.sqlite";
    
    IDbConnection dbConnection;
    IDbCommand dbCommand;
    IDataReader dataReader;

	
	void Start () {
        abrirDb();
	}

    private void abrirDb(){
        //1)Crear y abrir la conexión.
        rutaDb = Application.dataPath + "/StreamingAssets/" + DbFileName;
        strConexion = "URI=file:" + rutaDb;
        dbConnection = new SqliteConnection(strConexion);
        dbConnection.Open();

        //2)Crear la consulta
        dbCommand = dbConnection.CreateCommand();
        string sqlQuery = "select * from Camisas";
        dbCommand.CommandText = sqlQuery;

        //3)Leer la Bd
        dataReader = dbCommand.ExecuteReader();

        while(dataReader.Read()){ //Mientras esté leyendo la BD

            //id
            int id = dataReader.GetInt32(0); //obtiene el dato tipo int de la casilla nº0 (columna)
            //marca
            string marca = dataReader.GetString(1);
            //color
            string color = dataReader.GetString(2);
            //cantidades
            int cantidad = dataReader.GetInt32(3);

            Debug.Log(id + "-" + marca + "-" + color + "-" + cantidad);


        }

        dataReader.Close();
        dataReader = null;
        dbCommand.Dispose();
        dbCommand = null;
        dbConnection.Close();
        dbConnection = null;
    }
	
}
<file_sep>/README.md
# Ku
Repository Impls
<file_sep>/Assets/Scripts/Game/Sword.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sword : MonoBehaviour {


	public float swingingSpeed;
	public float cooldownSpeed;
	public float cooldownDuration;
	public float attackDuration;

	private float cooldownTimer;
	private Quaternion targetRotation;
	private Quaternion initialRotation;

	private bool isAttacking;

	public bool IsAttacking {
		get{
			return isAttacking;
		}
	}


	// Use this for initialization
	void Start () {
		isAttacking = false;
		initialRotation = this.transform.localRotation;//Quaternion.Euler(0f,0f,0f); //igual a rotacion inicial ...
		


		//attackDuration = 0.4f; //twitch later
		//cooldownDuration =as 5f;
	}
	
	// Update is called once per frame
	void Update () {
		transform.localRotation = Quaternion.Lerp (transform.localRotation, targetRotation, (isAttacking ? swingingSpeed : cooldownSpeed) * Time.deltaTime);
		cooldownTimer -= Time.deltaTime;
		Debug.Log("initialRotation: "+initialRotation+"\ntargetRotation: "+targetRotation);
	}


	public void Attack(){
		if (cooldownTimer > 0f) {
			return;		
		}
		isAttacking = true;
		targetRotation = Quaternion.Euler (75f,-20f,0f);
		cooldownTimer = cooldownDuration;
		StartCoroutine (CooldownAttack());
	}

	//Espera el tiempo de ataque y luego devuelve la espadita xD
	private IEnumerator CooldownAttack(){
		yield return new WaitForSeconds (attackDuration);
		isAttacking = false;
		targetRotation = initialRotation;//Quaternion.Euler (0f, 0f, 0f);
	}
}
<file_sep>/Assets/Scripts/Menu/GenericRepo.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class GenericRepo : MonoBehaviour {

    //public DbPartidas partida;
    public abstract void load();
    public abstract void save();
    
}
<file_sep>/Assets/Scripts/Game/Proyectile.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Proyectile : MonoBehaviour {

	// Use this for initialization
	public float proyectileSpeed = 700f;
	public float proyectileDuration = 7f;
	public int dmg;

	protected void starting () {
		GetComponent<Rigidbody> ().velocity = transform.forward * proyectileSpeed;
		Destroy (gameObject, proyectileDuration);
	}
}
<file_sep>/Assets/Scripts/Game/deadZone.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class deadZone : MonoBehaviour {

	void OnTriggerEnter(Collider other)
	{
		if (other.tag =="Player")
		{
			other.GetComponent<pepeplayer> ().respawn ();
		}
	}
}
<file_sep>/Assets/Scripts/Game/FollowCamera.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowCamera : MonoBehaviour {


	//public Transform targetFollow;
	//private Vector3 startPos;
	//private float offset_dis;
	//private Vector3 cameraPos;

	void Start(){
		//startPos = this.transform.position;
		//cameraPos = targetFollow.position + startPos;
		//offset_dis = Vector3.Distance (startPos, targetFollow.position);
	}

	private void update_offset(){
		//return Vector3.Distance (transform.position, targetFollow.position);
	}

}
<file_sep>/Assets/Scripts/Game/PatrollingLogic.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PatrollingLogic : MonoBehaviour {


	public Vector3[] directions;
	public float movingSpeed;
	public int timeToChange;

	public int directionIndex;
	public float directionTimer;
	private Rigidbody rb;

	// Use this for initialization
	void Start () {
		directionIndex =0;
		directionTimer = timeToChange;
		rb = GetComponent<Rigidbody>();
	}
	
	// Update is called once per frame
	void Update () {

		directionTimer -= Time.deltaTime;
		if(directionTimer<=0){
			directionTimer =timeToChange;
			directionIndex++;

			if(directionIndex >= directions.Length){
				directionIndex=0;
			}
		}

		rb.velocity = new Vector3 (
			directions[directionIndex].x * movingSpeed,
			rb.velocity.y,
			directions[directionIndex].z * movingSpeed

		);
		
	}
}
<file_sep>/Assets/Scripts/Game/fix_pos.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class fix_pos : MonoBehaviour {

	public Transform parent_obj;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		this.transform.position = parent_obj.position;
	}
}
<file_sep>/Assets/Scripts/Menu/SQLRepo.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using System.Data; //lib 1 BD
using System.IO; //lib 2 BD
using Mono.Data.Sqlite; //lib 3 BD
using System; //lib 4 BD (util)

public class SQLRepo : GenericRepo {

    public dataManagerPartidaUI dataManagerPartidaUI;

    private IDbConnection dbConnection;
    private IDbCommand dbCommand;
    private IDataReader dataReader;

    string rutaDb;
    string strConexion;
    string DbFileName = "manu2.db";
    private string table = "partidas";
    private string col1 = "id", col2 = "nombrePartida", col3 = "statePlayer", col4 = "fecha";
    private string values = "";



   

    public override void load(){
        rutaDb = Application.dataPath + "/StreamingAssets/" + DbFileName;
        strConexion = "URI=file:" + rutaDb;
        dbConnection = new SqliteConnection(strConexion);
        dbConnection.Open();

        Debug.Log("FlagL1");
        loadHelper("*");
        Debug.Log("FlagL2");
        dataManagerPartidaUI.loadHelper(); //dataManagerPartidaUI
        Debug.Log("FlagL3");

        //Cerrando DB...
        dataReader.Close();
        dataReader = null;
        dbCommand.Dispose();
        dbCommand = null;
        dbConnection.Close();
        dbConnection = null;


    }


    public override void save()
    {

        //Se Crea y abre la conexión con la BD.
        rutaDb = Application.dataPath + "/StreamingAssets/" + DbFileName;
        strConexion = "URI=file:" + rutaDb;
        dbConnection = new SqliteConnection(strConexion);
        dbConnection.Open();

        Debug.Log("Flag1");

        //Obteniendo valores de la partida actual (DbPartidas).
        DbPartidas dbp = GameObject.FindWithTag("loadedData").GetComponent<DbPartidas>();
        this.values = "('" + dbp.nombrePartida + "','" + dbp.playerState + "','" + dbp.fecha + "')";

        Debug.Log("Flag2");
        //Guardando datos..
        dbCommand = dbConnection.CreateCommand();
        string sqlQuery = "insert into " + table + " (" + col2 + "," + col3 + "," + col4 + ")" + " values " + this.values;
        dbCommand.CommandText = sqlQuery;
        dbCommand.ExecuteScalar();

        Debug.Log("Flag3");
        //Cerrando DB...
        dbCommand.Dispose();
        dbCommand = null;
        dbConnection.Close();
        dbConnection = null;
        Debug.Log("Saved");
    }

    protected void loadHelper(string item)
    {
        //2)Crear la consulta
        dbCommand = dbConnection.CreateCommand();
        string sqlQuery = "select " + item + " from " + table;
        dbCommand.CommandText = sqlQuery;
        //string[] row;
        int i = 0;

        //3)Leer la Bd
        dataReader = dbCommand.ExecuteReader();

        //string suma = "";
        while (dataReader.Read())
        { //Mientras esté leyendo la BD

            //id
            int id = dataReader.GetInt32(0); //obtiene el dato tipo int de la casilla nº0 (columna)
            //marca
            string nombrePartida = dataReader.GetString(1);
            //color
            string statePlayer = dataReader.GetString(2);
            //cantidades
            string fecha = dataReader.GetString(3);

            //var dbp = new DbPartidas(id, nombrePartida, statePlayer, fecha);
            DbPartidas dbp = dataManagerPartidaUI.partidasBox[i].GetComponent<DbPartidas>();
            dbp.construct(id, nombrePartida, statePlayer, fecha);
            dbp.ready = true;
            if (i < 2)
            {
                Debug.Log(i);
                i++;

            }

        }
    }

}
<file_sep>/Assets/Scripts/Game/SimpleEnemy.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SimpleEnemy : Enemy {


	// Use this for initialization
	void Start () {
		this.health = 3;
		this.dmg = 1;
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public override void Hit ()
	{
		base.Hit ();
		this.health--;
		Debug.Log ("Auch!");
		if (health <= 0) {
            Player_FPS player = GameObject.FindWithTag("Player").GetComponent<Player_FPS>();
            player.exp += 100;
			Destroy (gameObject);
		}
	}

}
<file_sep>/Assets/Scripts/Game/CameraCycle.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraCycle : MonoBehaviour {

	//Hice un cambito.
	public Camera[] cameraArr;
	private int index;
	// Use this for initialization
	void Start () {
		this.index = 0;
		usingCamera (this.index);
	}
	
	// Update is called once per frame
	void Update () {
		
		if (this.index > 2) {
			this.index = 0;
		}
		if (Input.GetKeyDown (KeyCode.Return) && this.index <=2) {
			usingCamera (this.index++);
		}


		
	}

	private void usingCamera(int index){
		for (int i = 0; i < cameraArr.Length; i++) {
			cameraArr [i].gameObject.SetActive (i == index);
		}
	
	}
}
<file_sep>/Library/Collab/Download/Assets/Scripts/DBobj.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DBobj : MonoBehaviour {


    /*
    *Tiene partidas (es un objeto)
    *Sabe parsear sus datos y se llena

    */
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
<file_sep>/Assets/Scripts/Game/ShootingEnemy.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ShootingEnemy : Enemy {

	// Use this for initialization

	//Este enemigo tiene una pequeña inclinación hacia adelante cuando se mueve (smooth)
	//Sigue al player y cuando está a R distancia de el se detiene, le apunta ( dirección en ese instante) y se demora t segundos en hacer el disparo (charging shoot)
	//luego espera t2 segundos y vuelve a empezar el ciclo de ataque(sigue al player)

	public Transform[] cannonPos;
	public GameObject bulletPrefab;
	public GameObject model;
	public float timeToShoot=3f;
	private float shootTimer;
    public Player_FPS player;


    void Start () {
		shootTimer=timeToShoot;
		dmg = 1;
        player = GameObject.FindWithTag("Player").GetComponent<Player_FPS>();
        Debug.Log("PlayerBombs: " + player.bombAmount);

    }
	
	// Update is called once per frame
	void Update () {
		shootTimer-= Time.deltaTime;
		if(shootTimer<=0f){
			shootTimer = timeToShoot;
				var bullet =Instantiate(bulletPrefab);
				bullet.transform.position = cannonPos[1].position + model.transform.forward;
				bullet.transform.forward = model.transform.forward;
			
		}
	}
	public override void Hit ()
	{

        base.Hit ();
		this.health--;
		Debug.Log ("Dush!");
		if (health <= 0) {

            player.exp += 100;
            Debug.Log("Playerexp: "+player.exp);
            Destroy (gameObject);
		}
	}
}
<file_sep>/Assets/Scripts/Game/PlayerMovement.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {

	public float rotatingSpeed;
	public float moveSpeed;
	public float jumpForce;
	private bool canJump;
	private Transform lastSpawn;
	public Transform firstSpawn;

	public Transform obj;
	// Use this for initialization
	void Start () {
		canJump = true;
		lastSpawn = firstSpawn;
	}

	void Update(){
		if (Input.GetKeyDown (KeyCode.Space) && canJump) {
			obj.transform.GetComponent<Rigidbody> ().AddForce (Vector3.up * moveSpeed * jumpForce);
			canJump = false;

		}
		processInput ();


	}

	private void processInput(){

		
		if (Input.GetKey (KeyCode.LeftArrow))
			this.transform.RotateAround (transform.position, Vector3.up, -rotatingSpeed * Time.deltaTime);
		if (Input.GetKey (KeyCode.RightArrow))
			this.transform.RotateAround (transform.position, Vector3.up, rotatingSpeed * Time.deltaTime);
		if (Input.GetKey (KeyCode.UpArrow))
			this.transform.position += transform.forward* moveSpeed * Time.deltaTime;
		if (Input.GetKey(KeyCode.DownArrow))
			this.transform.position += transform.forward * -moveSpeed * Time.deltaTime;
	}

	public Vector3 respawn(){
		transform.position = lastSpawn.position;
		return lastSpawn.position;
	}
	public void jumpAble(){
		canJump = true;
	}

	public void renewSpawn(Vector3 newSpawn){
		lastSpawn.position = newSpawn;
	}

		
}


<file_sep>/Assets/Scripts/Game/Player_FPS.cs
﻿using System.Collections;
using System.Collections.Generic;

using UnityEngine;

public class Player_FPS : MonoBehaviour {


		[Header("Visuals")]
		public GameObject modelPlayer;

		[Header("Attributes")]	
		public int health = 5;
        public int exp=0;
        public string achievements;

		[Header("Movement")]
		public float moveVelocity;
		public float jumpVelocity;
		public float rotatingSpeed;
		public float throwingSpeed;
		public float knockbackForce;
		public float knockbackTime;
		public float upForce;
		private float knockbackTimer;


		
		[Header("Equipment")]
		public Sword sword;
		public Bow bow;
		public int arrowAmount = 15;
		public GameObject bombPrefab;
		public int bombAmount;

		[Header("Others")]
		private bool canJump;
		private Quaternion playerModelRotation;
		private Transform lastSpawn;
		public Transform firstSpawn;
		private Rigidbody rb;
        private bool gameFlag = false;
        private bool isGrounded = false;
        private GameObject sceneController;



		// Use this for initialization
		void Start () {
			canJump = true;
			lastSpawn = firstSpawn;
			rb = transform.GetComponent<Rigidbody> ();
			//playerModelRotation = modelPlayer.GetComponent<Transform> ().rotation;
			bow.gameObject.SetActive (false);
            sceneController = GameObject.FindWithTag("SceneController");
            


        }

		void Update(){
			
			RaycastHit hit;
			if(Physics.Raycast(transform.position,Vector3.down,out hit,1.01f)){
				if (hit.collider.tag == "floor") {
					this.canJump = true;
                    this.isGrounded = true;
				}
			}
			

			//modelPlayer.transform.rotation = Quaternion.Lerp (modelPlayer.transform.rotation, playerModelRotation, rotatingSpeed * Time.deltaTime);
			if(knockbackTimer>0f){
				knockbackTimer-=Time.deltaTime;
			} else{
				processInput ();
			}
			


		}
    /*
        public void loadData(DbPartidas dbp){

        string[] subStrings = dbp.playerState.Split(':');
        this.transform.position = dbp.obtainPos(subStrings[0]);
        this.exp = int.Parse(subStrings[1]);
        Debug.Log("Cargando EXP: " + subStrings[1]);
        this.health = int.Parse(subStrings[2]);
        this.arrowAmount = int.Parse(subStrings[3]);
        this.bombAmount = int.Parse(subStrings[4]);
        this.achievements = subStrings[5];
    }*/

		private void processInput(){
			

		rb.velocity = new Vector3 (0f,rb.velocity.y,0f);
        /*
        float Horizontal = Input.GetAxis("Horizontal");
        float Vertical = Input.GetAxis("Vertical");

        if (Input.GetKey(KeyCode.W))
        {
            rb.velocity = transform.forward * (Vertical * speed);
        }
        if (Input.GetKey("s"))
        {
            rb.velocity = transform.forward * (Vertical * speed);
        }
        if (Input.GetKey("a"))
        {
            rb.velocity = transform.right * (Horizontal * speed);
        }
        if (Input.GetKey("d"))
        {
            rb.velocity = transform.right * (Horizontal * speed);
        }*/

        if(Input.GetKeyDown(KeyCode.Escape)){
            //llama un prepareSave del datamanagerplayer
            //GameObject.FindWithTag("SceneController")
            sceneController.GetComponent<dataManagerPlayer>().prepareSave();
            if (gameFlag)
            {
                sceneController.GetComponent<SceneController>().gameMenuOff();
                gameFlag = false;
            }
            else
            {
                sceneController.GetComponent<SceneController>().gameMenuOn();
                gameFlag = true;
            }
        }

			if (Input.GetKey (KeyCode.A)) {
            //rb.velocity = new Vector3 (-moveVelocity, rb.velocity.y, rb.velocity.z);
            //playerModelRotation = Quaternion.Euler (0f, 270f, 0f);
            rb.velocity += -transform.right * moveVelocity;
			}
			if (Input.GetKey (KeyCode.D)) {
            //rb.velocity = new Vector3 (moveVelocity, rb.velocity.y, rb.velocity.z);
            //playerModelRotation = Quaternion.Euler (0f, 90f, 0f);
            rb.velocity += transform.right * moveVelocity;
			}
			if (Input.GetKey (KeyCode.W)) {
            //rb.velocity = new Vector3 (rb.velocity.x, rb.velocity.y, moveVelocity);
            //playerModelRotation = Quaternion.Euler (0f, 0f, 0f);
            rb.velocity += transform.forward * moveVelocity;
        }
			if (Input.GetKey (KeyCode.S)) {
            rb.velocity -= transform.forward * moveVelocity;
            //playerModelRotation = Quaternion.Euler (0f, 180f, 0f);
        }

        if(isGrounded){
            rb.velocity = new Vector3(rb.velocity.x, 0f, rb.velocity.z);
            Debug.Log("Is grounded");
            //Vector fixY = 
        }

			if (Input.GetKeyDown (KeyCode.Space) && canJump) {
            ///rb.velocity = new Vector3 (rb.velocity.x, jumpVelocity, rb.velocity.z);
                rb.velocity += transform.up * jumpVelocity;
				canJump = false;
                isGrounded = false;


			}


        //Checking for equipment interaction

        if (Input.GetKeyDown (KeyCode.E)) {
				sword.Attack ();
				sword.gameObject.SetActive (true);
				bow.gameObject.SetActive (false);
			}
			if (Input.GetKeyDown (KeyCode.R)) {
				throwBomb ();
                bow.gameObject.SetActive(false);
        }
			if (Input.GetKeyDown (KeyCode.Q)) {
				if (arrowAmount <= 0) {
					return;
				}
				bow.Attack ();
				bow.gameObject.SetActive (true);
				sword.gameObject.SetActive (false);
				arrowAmount--;
			}
		}
		
		private void throwBomb(){
		if (bombAmount <= 0) {
			return;
		}
			var b = Instantiate (bombPrefab);
			b.transform.position = transform.position + modelPlayer.transform.forward; //* throwingSpeed;
			Vector3 throwingDir = (modelPlayer.transform.forward + Vector3.up).normalized;
			b.GetComponent<Rigidbody> ().AddForce (throwingDir * throwingSpeed);
			bombAmount--;
		}

		 
		public Vector3 respawn(){
			transform.position = lastSpawn.position;
			return lastSpawn.position;
		}
		
		public void jumpAble(){
			canJump = true;
		}

		public void renewSpawn(Vector3 newSpawn){
			lastSpawn.position = newSpawn;
		}

		

	public void OnTriggerEnter(Collider col){
		if (col.tag == "EnemyProyectile") {
			int dmg = col.GetComponent<Proyectile>().dmg;
			Vector3 knockback = (transform.position - col.transform.position).normalized;
			Vector3 knockbackDir = (knockback + Vector3.up*upForce).normalized;
			rb.velocity = new Vector3 (0f,0f,0f);
            Debug.Log("Entre al trigger");

			Hit (dmg,knockbackDir);
			Destroy(col.gameObject);
		}
	}

	public void OnCollisionEnter(Collision col){
		if (col.gameObject.tag == "Enemy") {
			int dmg = col.gameObject.GetComponent<Enemy>().dmg;
			Vector3 knockback = (transform.position - col.transform.position).normalized;
			Vector3 knockbackDir = (knockback + Vector3.up*upForce).normalized;
			rb.velocity = new Vector3 (0f,0f,0f);
            Debug.Log("Entre al collider!!!");
			Hit (dmg,knockbackDir);
		}
	}

	public void Hit(int dmg, Vector3 knockbackDir){

		
		this.rb.AddForce(knockbackDir * knockbackForce);
		knockbackTimer = knockbackTime;
		Debug.Log("OMG");
		health-=dmg;
		if (health <= 0) {
			Destroy (gameObject);
		}
	}

//}

}
<file_sep>/Assets/Scripts/Game/pepeplayer.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class pepeplayer : MonoBehaviour {

	public PlayerMovRB parent_obj;

	public void respawn(){
		//parent_obj.respawn ();
		//avisar al gc que corrija la camara
		transform.position = parent_obj.respawn ();
	}
	public void renewSpawn(Vector3 pos){
		parent_obj.renewSpawn (pos);
	}
	public void endlvl(){
		//hacer algo xD
	}

	void OnCollisionEnter(Collision hit)
	{
		if (hit.collider.tag == "floor") {
			parent_obj.jumpAble ();
		}else if (hit.collider.tag == "endZone") {
			endlvl ();
			Debug.Log ("Lvl finalizado");
		}
	}
	void OnTriggerEnter(Collider other)
	{
		if (other.tag == "deadZone") {
			respawn ();
		} else if (other.tag == "checkPoint") {
			renewSpawn (other.transform.position);
			Debug.Log ("Entrando al new check");
		} 
	}
}
<file_sep>/Assets/Scripts/Game/PlayerMovRB.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovRB : MonoBehaviour {

		[Header("Visuals")]
		public GameObject modelPlayer;

		[Header("Attributes")]	
		public int health = 5;

		[Header("Movement")]
		public float moveVelocity;
		public float jumpVelocity;
		public float rotatingSpeed;
		public float throwingSpeed;
		public float knockbackForce;
		public float knockbackTime;
		public float upForce;
		private float knockbackTimer;


		
		[Header("Equipment")]
		public Sword sword;
		public Bow bow;
		public int arrowAmount = 15;
		public GameObject bombPrefab;
		public int bombAmount;

		[Header("Others")]
		private bool canJump;
		private Quaternion playerModelRotation;
		private Transform lastSpawn;
		public Transform firstSpawn;
		private Rigidbody rb;



		// Use this for initialization
		void Start () {
			canJump = true;
			lastSpawn = firstSpawn;
			rb = transform.GetComponent<Rigidbody> ();
			playerModelRotation = modelPlayer.GetComponent<Transform> ().rotation;
			bow.gameObject.SetActive (false);
		}

		void Update(){
			
			RaycastHit hit;
			if(Physics.Raycast(transform.position,Vector3.down,out hit,1.01f)){
				if (hit.collider.tag == "floor") {
					this.canJump = true;
				}
			}
			modelPlayer.transform.rotation = Quaternion.Lerp (modelPlayer.transform.rotation, playerModelRotation, rotatingSpeed * Time.deltaTime);
			if(knockbackTimer>0f){
				knockbackTimer-=Time.deltaTime;
			} else{
				processInput ();
			}
			


		}

		private void processInput(){

		rb.velocity = new Vector3 (0f,rb.velocity.y,0f);

			if (Input.GetKey (KeyCode.LeftArrow)) {
				rb.velocity = new Vector3 (-moveVelocity, rb.velocity.y, rb.velocity.z);
				playerModelRotation = Quaternion.Euler (0f, 270f, 0f);
			}
			if (Input.GetKey (KeyCode.RightArrow)) {
				rb.velocity = new Vector3 (moveVelocity, rb.velocity.y, rb.velocity.z);
				playerModelRotation = Quaternion.Euler (0f, 90f, 0f);
			}
			if (Input.GetKey (KeyCode.UpArrow)) {
				rb.velocity = new Vector3 (rb.velocity.x, rb.velocity.y, moveVelocity);
				playerModelRotation = Quaternion.Euler (0f, 0f, 0f);
			}
			if (Input.GetKey (KeyCode.DownArrow)) {
				rb.velocity = new Vector3 (rb.velocity.x, rb.velocity.y, -moveVelocity);
				playerModelRotation = Quaternion.Euler (0f, 180f, 0f);
			}

			if (Input.GetKeyDown (KeyCode.Space) && canJump) {
				rb.velocity = new Vector3 (rb.velocity.x, jumpVelocity, rb.velocity.z);
				canJump = false;


			}


			//Checking for equipment interaction

			if (Input.GetKeyDown (KeyCode.X)) {
				sword.Attack ();
				sword.gameObject.SetActive (true);
				bow.gameObject.SetActive (false);
			}
			if (Input.GetKeyDown (KeyCode.Z)) {
				throwBomb ();
			}
			if (Input.GetKeyDown (KeyCode.C)) {
				if (arrowAmount <= 0) {
					return;
				}
				bow.Attack ();
				bow.gameObject.SetActive (true);
				sword.gameObject.SetActive (false);
				arrowAmount--;
			}
		}
		
		private void throwBomb(){
		if (bombAmount <= 0) {
			return;
		}
			var b = Instantiate (bombPrefab);
			b.transform.position = transform.position + modelPlayer.transform.forward; //* throwingSpeed;
			Vector3 throwingDir = (modelPlayer.transform.forward + Vector3.up).normalized;
			b.GetComponent<Rigidbody> ().AddForce (throwingDir * throwingSpeed);
			bombAmount--;
		}

		 
		public Vector3 respawn(){
			transform.position = lastSpawn.position;
			return lastSpawn.position;
		}
		public void jumpAble(){
			canJump = true;
		}

		public void renewSpawn(Vector3 newSpawn){
			lastSpawn.position = newSpawn;
		}

		

	public void OnTriggerEnter(Collider col){
		if (col.tag == "EnemyProyectile") {
			int dmg = col.GetComponent<Proyectile>().dmg;
			Vector3 knockback = (transform.position - col.transform.position).normalized;
			Vector3 knockbackDir = (knockback + Vector3.up*upForce).normalized;
			rb.velocity = new Vector3 (0f,0f,0f);

			Hit (dmg,knockbackDir);
			Destroy(col.gameObject);
		}
	}

	public void OnCollisionEnter(Collision col){
		if (col.gameObject.tag == "Enemy") {
			int dmg = col.gameObject.GetComponent<Enemy>().dmg;
			Vector3 knockback = (transform.position - col.transform.position).normalized;
			Vector3 knockbackDir = (knockback + Vector3.up*upForce).normalized;
			rb.velocity = new Vector3 (0f,0f,0f);

			Hit (dmg,knockbackDir);
		}
	}

	public void Hit(int dmg, Vector3 knockbackDir){

		
		this.rb.AddForce(knockbackDir * knockbackForce);
		knockbackTimer = knockbackTime;
		Debug.Log("OMG");
		health-=dmg;
		if (health <= 0) {
			Destroy (gameObject);
		}
	}

}
<file_sep>/Library/Collab/Download/Assets/Plugins/DbPartidas.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DbPartidas : MonoBehaviour {

    // Use this for initialization
    int id;
    string nombrePartida;
    string playerState;
    string fecha;

    //Vector3 position;
    string position;
    int exp;
    int lifes;
    int nArrows;
    int nBombs;
    string achievements;

    public DbPartidas(int id, string nombrePartida, string playerState, string fecha){
        this.id = id;
        this.nombrePartida = nombrePartida;
        this.playerState = playerState;
        this.fecha = fecha;

        parsePlayerState();



    }

    private void parsePlayerState(){
        //string myString = "12,Apple,20";
        Debug.Log(playerState);
        string[] subStrings = playerState.Split(':');
        /*
        this.position = subStrings[0];
        this.exp = int.Parse(subStrings[1]); 
        this.lifes = int.Parse(subStrings[2]);
        this.nArrows = int.Parse(subStrings[3]);
        this.nBombs = int.Parse(subStrings[4]);
        this.achievements = subStrings[5];*/
    }


	
	//sabe leer sus datos...

}
<file_sep>/Assets/Scripts/Game/Bomb.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bomb : MonoBehaviour {

	// Use this for initialization

	public float duration;
	public float radius;
	public float explosionDuration;
	public GameObject explosionModel;


	private float explosionTimer;
	private bool exploded;

	void Start () {
		explosionTimer = duration;
		explosionModel.SetActive(false);
		explosionModel.transform.localScale = Vector3.one * radius;
		exploded = false;
	}
	
	// Update is called once per frame
	void Update () {
		explosionTimer -= Time.deltaTime;
		if (explosionTimer <= 0f && !exploded) {
			exploded = true;
			Collider[] colliders =Physics.OverlapSphere (transform.position, radius);

			foreach (Collider c in colliders) {
				Debug.Log ("Ha chocado el tio con " + c.name+"\n");
				if (((c.tag == "Enemy") || (c.tag == "enemyWeakPoint")) && c.GetComponent<Enemy>() != null) {
					c.GetComponent<Enemy> ().Hit ();
				}
			}
			StartCoroutine (doExplosion ());
		}
	}


	private IEnumerator doExplosion(){
		explosionModel.SetActive(true);
		yield return new WaitForSeconds (explosionDuration);
		explosionModel.SetActive(false);
		Destroy (this.gameObject);
	}

}
<file_sep>/Library/Collab/Download/Assets/Plugins/loaderGame.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class loaderGame : MonoBehaviour {

    // Use thi  public GameObject[] partida;
    public SQLCommands bdein;
    public GameObject[] partidasBox;
	
    void Start()
    {
        /*
        foreach(GameObject obj in partidasBox){
            obj.SetActive(false);
        }


        int i = 0;
        //establecer conexión a la base de datos y preguntar por todas las partidas (3 max)
        foreach (DbPartidas db in bdein.dbPartidas)
        {
            partidasBox[i].SetActive(true);
            partidasBox[i].GetComponentInChildren<Text>().text = "hola";
            Debug.Log("HIII entre aqui!");
        }*/
    }
}

<file_sep>/Assets/Scripts/Menu/MenuSceneManager.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class MenuSceneManager : MonoBehaviour {

	// Use this for initialization
	public void newGame () {
		SceneManager.LoadScene("Terrainy");
	}

    public void loadGame(){
        SceneManager.LoadScene("Loading");
    }

    public void loadGameFromGame(){
        //cerrarDb_ins();
        SceneManager.LoadScene("Loading");
    }

    public void mainMenu(){
        SceneManager.LoadScene("MainMenu");
    }

    public void testing(){
        Debug.Log("works");
    }

    public void exitGame(){
        Application.Quit();
    }
	
	
}
<file_sep>/Assets/Scripts/Menu/DbPartidas.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DbPartidas : MonoBehaviour {

    // Use this for initialization
    public GameObject loadedData;

    public int id;
    public string nombrePartida;
    public string playerState; //statePlayer= pos:exp:vidas:flechas:bombas:logros
    //-> 0f,0f,0f:120:3:10:4:ninguno -> 6 campiños
    public  string fecha;

    public bool ready;

    //Vector3 position;

    public Vector3 position;
    public int exp;
    public int health;
    public int nArrows;
    public int nBombs;
    public string achievements;

    private void Start()
    {
        DontDestroyOnLoad(this.gameObject);
    }

    public void construct(int id, string nombrePartida, string playerState, string fecha)
    {
        this.id = id;
        this.nombrePartida = nombrePartida;
        this.playerState = playerState;
        this.fecha = fecha;

       
        // parsePlayerState();




    }

    public void parsePlayerState(){
        //string myString = "12,Apple,20";
        Debug.Log(playerState);


       

    }

    public Vector3 obtainPos(string pos_str){
        string[] subStrings = pos_str.Split(',');
        return new Vector3(float.Parse(subStrings[0]),float.Parse(subStrings[1]),float.Parse(subStrings[2]));
    }
    public void debug(string datitos){

        Debug.Log(/*"Mi id es: " + this.id +*/ "\n" +
                  "Mi nombre partida es: " + this.nombrePartida + "\n" +
                  "Mi player state es: " + this.playerState + "\n" +
                  "Mi fecha es: " + this.fecha +"\n"+
                  "y mis datos extraidos son"+datitos);

    }

    public string infoPartida(){
        return /*this.id + "-" */ this.nombrePartida + "-" + this.fecha;
    }

    public void saveData(){
        DbPartidas dbp = loadedData.GetComponent<DbPartidas>();
        //dbp.id = this.id;
        dbp.nombrePartida = "PartidaY";//this.nombrePartida;
        dbp.playerState = this.playerState;
        dbp.fecha = this.fecha;
        //parsePlayerState();
    }




	
	//sabe leer sus datos...

}
