Exemple #1
0
 public void remove_foe(G_Foes g)
 {
     if (g.Verduras > 0)
     {
         spVerduQuantity--;
     }
     if (g.Frutas > 0)
     {
         spFrutaQuantity--;
     }
     if (g.Animal > 0)
     {
         spCarneQuantity--;
     }
     if (g.Cereales > 0)
     {
         spCerealQuantity--;
     }
     if (g.Dulces > 0)
     {
         spDulceQuantity--;
     }
     if (g.lacteos > 0)
     {
         spLecheQuantity--;
     }
 }
Exemple #2
0
    public void Spawn()
    {
        G_Foes food = Resources.Load(lista_comida[0, Random.Range(0, 5)], typeof(G_Foes)) as G_Foes;

        Instantiate(food, Spawn_position(), Quaternion.identity);
        //Debug.Log(food.name);
        Foe_List.Add(food);
    }
Exemple #3
0
//para mantener contante la cantidad de objetos que aparecen y que haya oportunidad de todo


    public void Spawn(int type)
    {
        if (type == 1)
        {
            G_Foes food = Resources.Load(lista_verdura[Random.Range(0, lista_verdura.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spVerduQuantity++;
        }

        if (type == 2)
        {
            G_Foes food = Resources.Load(lista_fruta[Random.Range(0, lista_fruta.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spFrutaQuantity++;
        }

        if (type == 3)
        {
            G_Foes food = Resources.Load(lista_cereal[Random.Range(0, lista_cereal.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spCerealQuantity++;
        }

        if (type == 4)
        {
            G_Foes food = Resources.Load(lista_carne[Random.Range(0, lista_carne.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spCarneQuantity++;
        }

        if (type == 5)
        {
            G_Foes food = Resources.Load(lista_leche[Random.Range(0, lista_leche.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spLecheQuantity++;
        }

        if (type == 6)
        {
            G_Foes food = Resources.Load(lista_dulce[Random.Range(0, lista_dulce.Length)], typeof(G_Foes)) as G_Foes;
            Debug.Log(food);
            Instantiate(food, Spawn_position(), Quaternion.identity);
            spDulceQuantity++;
        }
    }
Exemple #4
0
 bool isCandyDestroyed(G_Foes g)
 {
     if (g.Animal == 0 && g.Cereales == 0 && g.Frutas == 0 && g.Verduras == 0 && g.lacteos == 0)
     {
         if (SL.account)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemple #5
0
    public void update_score(G_Foes c)
    {
        //Dependiendo del tipo del objeto, actualizar HEALTH / SCORE / METAS

        if (SL.GetOption() == 2)
        {
            //si come un alimento de origen animal
            if (c.Animal > 0)
            {
                this.Carne += c.Animal;
                //si la meta fue completada o no
                if (carne_f)
                {
                    health -= 8;
                    Score  -= 10;
                    excesos++;
                }
                else
                {
                    health += 4;
                    Score  += 80;
                    eatenCarne++;
                }
            }
            //si come verduras
            if (c.Verduras > 0)
            {
                this.Verduras += c.Verduras;
                if (verduras_f)
                {
                    health -= 8;
                    Score  -= 10;
                    excesos++;
                }
                else
                {
                    health += 4;
                    Score  += 80;
                    eatenVerduras++;
                }
            }
            //si come frutas
            if (c.Frutas > 0)
            {
                this.Frutas += c.Frutas;
                if (frutas_f)
                {
                    health -= 8;
                    Score  -= 10;
                    excesos++;
                }
                else
                {
                    health += 4;
                    Score  += 80;
                    eatenFrutas++;
                }
            }
            //si come cereales
            if (c.Cereales > 0)
            {
                this.Cereales += c.Cereales;
                if (cereales_f)
                {
                    health -= 8;
                    Score  -= 10;
                    excesos++;
                }
                else
                {
                    health += 4;
                    Score  += 80;
                    eatenCereales++;
                }
            }
            //si come lacteos
            if (c.lacteos > 0)
            {
                this.Lacteos += c.lacteos;
                if (lacteos_f)
                {
                    health -= 8;
                    Score  -= 10;
                    excesos++;
                }
                else
                {
                    health += 4;
                    Score  += 80;
                    eatenLacteos++;
                }
            }
            //si come dulces
            if (c.Dulces > 0)
            {
                health -= 8;
                Score  -= 20;
            }
        }


        if (SL.GetOption() == 5)
        {
            //si destruye un alimento de origen animal
            if (c.Animal > 0)
            {
                //si la meta fue completada o no
                if (carne_f)
                {
                    health += 2;
                    Score  += 80;
                }
                else
                {
                    Score += 10;
                }
            }
            //si destruye verduras
            if (c.Verduras > 0)
            {
                if (verduras_f)
                {
                    health += 2;
                    Score  += 80;
                }
                else
                {
                    Score += 10;
                }
            }
            //si destruye frutas
            if (c.Frutas > 0)
            {
                if (frutas_f)
                {
                    health += 2;
                    Score  += 80;
                }
                else
                {
                    Score += 10;
                }
            }
            //si destruye cereales
            if (c.Cereales > 0)
            {
                if (cereales_f)
                {
                    health += 2;
                    Score  += 80;
                }
                else
                {
                    Score += 10;
                }
            }
            //si destruye lacteos
            if (c.lacteos > 0)
            {
                if (lacteos_f)
                {
                    health += 2;
                    Score  += 80;
                }
                else
                {
                    Score += 10;
                }
            }
            //si destruye dulces
            if (c.Dulces > 0)
            {
                destroyedDulces++;
                health += 10;
                Score  += 100;
            }
        }

        Check_carne();
        Check_cereales();
        Check_fruta();
        Check_lacteos();
        Check_verduras();

        /*if(c.Animal>0)
         * {
         *      if(carne_f)
         *              health -=15;
         *      else
         *              health +=8;
         * }
         *
         * if(c.Verduras>0)
         * {
         *      if(verduras_f)
         *              health -=15;
         *      else
         *              health +=8;
         * }
         *
         * if(c.Frutas>0)
         * {
         *      if(frutas_f)
         *              health -=15;
         *      else
         *              health +=8;
         * }
         *
         * if(c.Cereales>0)
         * {
         *      if(cereales_f)
         *              health -=15;
         *      else
         *              health +=8;
         * }
         *
         * if(c.lacteos > 0)
         * {
         *      if(lacteos_f)
         *              health -=15;
         *      else
         *              health +=8;
         * }
         *
         * if(isCandyDestroyed(c))
         * {
         *
         *      G_candy += 1;
         *
         * }
         *
         *
         * if(SL.account){
         * this.Carne += c.Animal*(1/M_Carne);
         * this.Lacteos += c.lacteos*(1/M_Lacteos);
         * this.Verduras += c.Verduras*(1/M_Verduras);
         * this.Cereales += c.Cereales*(1/M_Cereales);
         * this.Frutas += c.Frutas*(1/M_Frutas);
         * this.Score += c.Points;
         *
         * total += 0.7f;
         * }
         *
         * Check_carne();
         * Check_cereales();
         * Check_fruta();
         * Check_lacteos();
         * Check_verduras();
         */
    }
Exemple #6
0
    public void update_score(G_Foes c)
    {
        if (c.Animal > 0)
        {
            if (carne_f)
            {
                health -= 15;
            }
            else
            {
                health += 8;
            }
        }

        if (c.Verduras > 0)
        {
            if (verduras_f)
            {
                health -= 15;
            }
            else
            {
                health += 8;
            }
        }

        if (c.Frutas > 0)
        {
            if (frutas_f)
            {
                health -= 15;
            }
            else
            {
                health += 8;
            }
        }

        if (c.Cereales > 0)
        {
            if (cereales_f)
            {
                health -= 15;
            }
            else
            {
                health += 8;
            }
        }

        if (c.lacteos > 0)
        {
            if (lacteos_f)
            {
                health -= 15;
            }
            else
            {
                health += 8;
            }
        }

        this.Carne    += c.Animal * (1 / M_Carne);
        this.Lacteos  += c.lacteos * (1 / M_Lacteos);
        this.Verduras += c.Verduras * (1 / M_Verduras);
        this.Cereales += c.Cereales * (1 / M_Cereales);
        this.Frutas   += c.Frutas * (1 / M_Frutas);
        this.Score    += c.Points;

        total += 0.7f;

        Check_carne();
        Check_cereales();
        Check_fruta();
        Check_lacteos();
        Check_verduras();
    }
Exemple #7
0
 public void remove_foe(G_Foes g)
 {
     Debug.Log("Comida eliminada" + g.Name);
     ct_enemies--;
 }