示例#1
0
    void Start()
    {
        PokemonOwnedDAO     pkmOwned    = new PokemonOwnedDAO();
        PokemonBasicDAO     pkmBasic    = new PokemonBasicDAO();
        EggOwnedDAO         eggOwned    = new EggOwnedDAO();
        List <PokemonOwned> listPokemon = pkmOwned.GetEquippedPokemon().ToList();

        if (listPokemon.Count() == 1)
        {
            pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";
            PokemonBasic basico = pkmBasic.GetPokemon(listPokemon [0].Id);
            Debug.Log(basico);
            primerNombre.GetComponent <UILabel> ().text = basico.Name + " Nvl " + listPokemon [0].Level;
        }
        else if (listPokemon.Count() == 2)
        {
            pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";
            PokemonBasic basico = pkmBasic.GetPokemon(listPokemon [0].IdBasic);
            primerNombre.GetComponent <UILabel> ().text = basico.Name + " Nvl: " + listPokemon [0].Level;

            pokemon2.GetComponent <UISprite> ().spriteName = (listPokemon [1].IdBasic) + "";
            PokemonBasic segundoBasico = pkmBasic.GetPokemon(listPokemon [1].IdBasic);
            segundoNombre.GetComponent <UILabel> ().text = segundoBasico.Name + " Nvl: " + listPokemon [1].Level;
        }
        else if (listPokemon.Count() == 3)
        {
            pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";
            PokemonBasic basico = pkmBasic.GetPokemon(listPokemon [0].IdBasic);
            primerNombre.GetComponent <UILabel> ().text = basico.Name + " Nvl: " + listPokemon [0].Level;

            pokemon2.GetComponent <UISprite> ().spriteName = (listPokemon [1].IdBasic) + "";
            PokemonBasic segundoBasico = pkmBasic.GetPokemon(listPokemon [1].IdBasic);
            segundoNombre.GetComponent <UILabel> ().text = segundoBasico.Name + " Nvl: " + listPokemon [1].Level;

            pokemon3.GetComponent <UISprite> ().spriteName = (listPokemon [2].IdBasic) + "";
            PokemonBasic tercerBasico = pkmBasic.GetPokemon(listPokemon [2].IdBasic);
            tercerNombre.GetComponent <UILabel> ().text = tercerBasico.Name + " Nvl: " + listPokemon [2].Level;
        }

        if (eggOwned.GetEquippedEgg() != null)
        {
            huevo.GetComponent <UILabel> ().text                       = "Huevo " + eggOwned.GetEquippedEgg().Category;
            huevoSprite.GetComponent <UISprite>().spriteName           = "Egg";
            huevoSprite.GetComponent <UISprite>().transform.localScale = new Vector3(200, 200, 1);
        }
        else
        {
            huevoSprite.GetComponent <UISprite>().spriteName = "0";
        }
    }
    void Update()
    {
        EggOwnedDAO eggOwned = new EggOwnedDAO();
        EggOwned    owned    = eggOwned.GetEquippedEgg();

        nombre.GetComponent <UILabel> ().text                  = "Huevo " + owned.Category;
        descripcion.GetComponent <UILabel> ().text             = "Un huevo de tipo " + owned.Category;
        stats.GetComponent <UILabel> ().text                   = "Ciclos: " + owned.CurrentCycles + "/" + owned.TotalCycles;
        sprite.GetComponent <UISprite> ().spriteName           = "Egg";
        sprite.GetComponent <UISprite> ().transform.localScale = new Vector3(200, 200, 0);
    }
示例#3
0
    void OnClick()
    {
        PokemonOwnedDAO pkmOwned = new PokemonOwnedDAO();
        EggOwnedDAO     eggOwned = new EggOwnedDAO();

        switch (transform.parent.name)
        {
        case "Pokemon000":
            if (pkmOwned.GetEquippedPokemon().ToList().Count() > 0)
            {
                UIController.instance.MostrarPanelDatosPokemon(1);
            }
            else
            {
                UIController.instance.MostrarPanelMensaje("No tienes ningun pokemon equipado ahi");
            }
            break;

        case "Pokemon001":
            if (pkmOwned.GetEquippedPokemon().ToList().Count() > 1)
            {
                UIController.instance.MostrarPanelDatosPokemon(2);
            }
            else
            {
                UIController.instance.MostrarPanelMensaje("No tienes ningun pokemon equipado ahi");
            }
            break;

        case "Pokemon002":
            if (pkmOwned.GetEquippedPokemon().ToList().Count() > 2)
            {
                UIController.instance.MostrarPanelDatosPokemon(3);
            }
            else
            {
                UIController.instance.MostrarPanelMensaje("No tienes ningun pokemon equipado ahi");
            }
            break;

        case "Huevo":
            if (eggOwned.GetEquippedEgg() != null)
            {
                UIController.instance.MostrarPanelDatosPokemon(4);
            }
            else
            {
                UIController.instance.MostrarPanelMensaje("No tienes ningun huevo equipado");
            }
            break;
        }
    }
示例#4
0
 void OnClick()
 {
     if (sePuedeEquipar)
     {
         EggOwnedDAO eggOwned = new EggOwnedDAO();
         if (eggOwned.GetEquippedEgg() != null)
         {
             UIController.instance.MostrarPanelMensaje("Ya tienes un huevo equipado\n Hasta que no eclosione no podras equiparte otro");
         }
         else
         {
             UIController.instance.MostrarPanelMensaje("Te has equipado el huevo");
             eggOwned.EquipEgg(int.Parse(transform.name));
         }
     }
 }
示例#5
0
    void FixedUpdate()
    {
        curAcc = Mathf.Lerp(curAcc, Input.acceleration.magnitude, fHigh);
        avgAcc = Mathf.Lerp(avgAcc, Input.acceleration.magnitude, fLow);
        float delta = curAcc - avgAcc;

        if (delta > hiLim)
        {
            steps++;
        }

        if (steps > 10)
        {
            stepsEgg++;
            actualizarDatos = true;
            PokemonOwnedDAO     pkmOwned    = new PokemonOwnedDAO();
            List <PokemonOwned> listPokemon = pkmOwned.GetEquippedPokemon().ToList();
            PlayerDAO           playerDAO   = new PlayerDAO();
            EggOwnedDAO         eggOwned    = new EggOwnedDAO();
            for (int i = 0; i < listPokemon.Count(); i++)
            {
                if (listPokemon[i].CurrentHappyness > 1)
                {
                    listPokemon[i].CurrentHappyness  -= 1;
                    listPokemon[i].CurrentExperience += 2;
                    if (listPokemon[i].CurrentExperience > listPokemon[i].ExperienceNeeded)
                    {
                        listPokemon[i].LevelUp();
                        playerDAO.UpdateGold(playerDAO.GetPlayer().Gold + (listPokemon[i].Level * 5));
                    }
                    pkmOwned.UpdatePokemon(listPokemon[i].Id, listPokemon[i]);
                }
            }
            if (stepsEgg == 3)
            {
                if (eggOwned.GetEquippedEgg() != null)
                {
                    eggOwned.AumentarCiclo();
                }
                stepsEgg = 0;
            }
            steps = 0;
        }
    }
示例#6
0
    void Update()
    {
        PokemonOwnedDAO     pkmOwned    = new PokemonOwnedDAO();
        List <PokemonOwned> listPokemon = pkmOwned.GetEquippedPokemon().ToList();
        PokemonBasicDAO     pkmBasic    = new PokemonBasicDAO();
        EggOwnedDAO         eggOwned    = new EggOwnedDAO();

        if (actualizarDatos)
        {
            if (listPokemon.Count() == 1)
            {
                float amountFirst = (listPokemon [0].CurrentHappyness * 100) / listPokemon [0].Happyness;
                nombre1.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[0].IdBasic).Name + " Nvl: " + listPokemon[0].Level;
                pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";

                GameObject fore = progressBar1.transform.FindChild("ForegroundBar000").gameObject;
                fore.GetComponent <UISprite> ().fillAmount = (amountFirst / 100);

                float      amountExp = (listPokemon[0].CurrentExperience * 100) / listPokemon[0].ExperienceNeeded;
                GameObject foreExp   = barraExperiencia1.transform.FindChild("ForeExp000").gameObject;
                foreExp.GetComponent <UISprite>().fillAmount = (amountExp / 100);
            }
            else if (listPokemon.Count() == 2)
            {
                float amountFirst = (listPokemon [0].CurrentHappyness * 100) / listPokemon [0].Happyness;
                nombre1.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[0].IdBasic).Name + " Nvl: " + listPokemon[0].Level;
                pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";
                GameObject fore = progressBar1.transform.FindChild("ForegroundBar000").gameObject;
                fore.GetComponent <UISprite> ().fillAmount = (amountFirst / 100);

                float      amountExp = (listPokemon[0].CurrentExperience * 100) / listPokemon[0].ExperienceNeeded;
                GameObject foreExp   = barraExperiencia1.transform.FindChild("ForeExp000").gameObject;
                foreExp.GetComponent <UISprite>().fillAmount = (amountExp / 100);

                float amountSecond = ((listPokemon [1].CurrentHappyness * 100) / listPokemon [1].Happyness);
                nombre2.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[1].IdBasic).Name + " Nvl: " + listPokemon[1].Level;
                pokemon2.GetComponent <UISprite> ().spriteName = (listPokemon [1].IdBasic) + "";
                GameObject fore2 = progressBar2.transform.FindChild("ForegroundBar001").gameObject;
                fore2.GetComponent <UISprite> ().fillAmount = (amountSecond / 100);

                float      amountExp2 = (listPokemon[1].CurrentExperience * 100) / listPokemon[1].ExperienceNeeded;
                GameObject foreExp2   = barraExperiencia2.transform.FindChild("ForeExp001").gameObject;
                foreExp2.GetComponent <UISprite>().fillAmount = amountExp2 / 100;
            }
            else if (listPokemon.Count() == 3)
            {
                float amountFirst = (listPokemon [0].CurrentHappyness * 100) / listPokemon [0].Happyness;
                nombre1.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[0].IdBasic).Name + " Nvl: " + listPokemon[0].Level;
                pokemon1.GetComponent <UISprite> ().spriteName = (listPokemon [0].IdBasic) + "";
                GameObject fore = progressBar1.transform.FindChild("ForegroundBar000").gameObject;
                fore.GetComponent <UISprite> ().fillAmount = (amountFirst / 100);

                float      amountExp = (listPokemon[0].CurrentExperience * 100) / listPokemon[0].ExperienceNeeded;
                GameObject foreExp   = barraExperiencia1.transform.FindChild("ForeExp000").gameObject;
                foreExp.GetComponent <UISprite>().fillAmount = (amountExp / 100);

                float amountSecond = ((listPokemon [1].CurrentHappyness * 100) / listPokemon [1].Happyness);
                nombre2.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[1].IdBasic).Name + " Nvl: " + listPokemon[1].Level;
                pokemon2.GetComponent <UISprite> ().spriteName = (listPokemon [1].IdBasic) + "";
                GameObject fore2 = progressBar2.transform.FindChild("ForegroundBar001").gameObject;
                fore2.GetComponent <UISprite> ().fillAmount = (amountSecond / 100);

                float      amountExp2 = (listPokemon[1].CurrentExperience * 100) / listPokemon[1].ExperienceNeeded;
                GameObject foreExp2   = barraExperiencia2.transform.FindChild("ForeExp001").gameObject;
                foreExp2.GetComponent <UISprite>().fillAmount = amountExp2 / 100;

                float amountThird = ((listPokemon [2].CurrentHappyness * 100) / listPokemon [2].Happyness);
                nombre3.GetComponent <UILabel>().text          = pkmBasic.GetPokemon(listPokemon[2].IdBasic).Name + " Nvl: " + listPokemon[2].Level;
                pokemon3.GetComponent <UISprite> ().spriteName = (listPokemon [2].IdBasic) + "";
                GameObject fore3 = progressBar3.transform.FindChild("ForegroundBar002").gameObject;
                fore3.GetComponent <UISprite> ().fillAmount = (amountThird / 100);

                float      amountExp3 = (listPokemon[2].CurrentExperience * 100) / listPokemon[2].ExperienceNeeded;
                GameObject foreExp3   = barraExperiencia3.transform.FindChild("ForeExp002").gameObject;
                foreExp3.GetComponent <UISprite>().fillAmount = amountExp3 / 100;
            }
            else if (listPokemon.Count() == 0)
            {
                pokemon1.GetComponent <UISprite> ().spriteName = "0";
                pokemon2.GetComponent <UISprite> ().spriteName = "0";
                pokemon3.GetComponent <UISprite> ().spriteName = "0";
            }
            actualizarDatos = false;
            if (eggOwned.GetEquippedEgg() != null)
            {
                EggOwned egg = eggOwned.GetEquippedEgg();
                nombreHuevo.GetComponent <UILabel>().text = "Huevo " + egg.Category;
                float      amountEgg = ((egg.CurrentCycles * 100) / egg.TotalCycles);
                GameObject fore      = barraHuevo.transform.FindChild("Foreground").gameObject;
                spriteHuevo.GetComponent <UISprite>().spriteName           = "Egg";
                fore.GetComponent <UISprite>().fillAmount                  = amountEgg / 100;
                spriteHuevo.GetComponent <UISprite>().transform.localScale = new Vector3(150, 150, 0);
            }
            else
            {
                spriteHuevo.GetComponent <UISprite>().spriteName = "0";
            }
        }
    }