コード例 #1
0
    public void LstMamute()
    {
        if (LastMonster == "Aguia")
        {
            Destroy(Aguia);
            DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TAguia);
        }
        else if (LastMonster == "Peixe")
        {
            Destroy(Fish);
            DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TPeixe);
        }

        Mamute = Instantiate(Resources.Load("AnimalsAdmPREFABS/Mamute[LAB]")) as GameObject;
        Mamute.SetActive(true);
        MenuStatus.GetComponent <StatsBehaviour>().MamuteValues();
        if (!MenuStatus.activeInHierarchy && !MenuInject.activeInHierarchy)
        {
            EnableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TMamute);
        }
        else if (MenuStatus.activeInHierarchy)
        {
            MenuStatus.GetComponent <StatsBehaviour>().ShowValues();
        }

        LastMonster = "Mamute";
    }
コード例 #2
0
    public void LstPeixe()
    {
        if (LastMonster == "Aguia")
        {
            Destroy(Aguia);
            DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TAguia);
        }
        else if (LastMonster == "Mamute")
        {
            Destroy(Mamute);
            DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TMamute);
        }

        Fish = Instantiate(Resources.Load("Prefabs/Peixe2")) as GameObject;
        Fish.SetActive(true);
        MenuStatus.GetComponent <StatsBehaviour>().PeixeValues();

        if (!MenuStatus.activeInHierarchy && !MenuInject.activeInHierarchy)
        {
            EnableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TPeixe);
        }
        else if (MenuStatus.activeInHierarchy)
        {
            MenuStatus.GetComponent <StatsBehaviour>().ShowValues();
        }

        LastMonster = "Peixe";
    }
コード例 #3
0
 public void Close()
 {
     if (MenuInject.activeInHierarchy)
     {
         ItemInject.GetComponent <SpriteRenderer> ().sprite = null;
         ItemSelect = null;
         MenuInject.SetActive(false);
         CollidersEnable(btnInjection);
         CollidersEnable(btnStatus);
         EnableGameObjects(Monstros);
         if (LastMonster == "Aguia")
         {
             EnableGameObjects(Aguia);
         }
         else if (LastMonster == "Peixe")
         {
             EnableGameObjects(Fish);
         }
         else if (LastMonster == "Mamute")
         {
             EnableGameObjects(Mamute);
         }
     }
     else if (MenuStatus.activeInHierarchy)
     {
         ItemInject.GetComponent <SpriteRenderer> ().sprite = null;
         MenuStatus.GetComponent <StatsBehaviour>().Cancelar();
         ItemSelect = null;
         DisableGameObjects(MenuStatus);
         EnableGameObjects(btnStatus);
         EnableGameObjects(btnInjection);
         CollidersEnable(rightArrow);
         CollidersEnable(leftArrow);
     }
 }
コード例 #4
0
 public void ChangeLeft()
 {
     if (LastMonster == "Aguia")
     {
         LstPeixe();
     }
     else if (LastMonster == "Peixe")
     {
         LstMamute();
     }
     else if (LastMonster == "Mamute")
     {
         LstAguia();
     }
     MenuStatus.GetComponent <StatsBehaviour> ().AtualBars();
 }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        audio.Play();
        // Liste todos os games objects
        ListGameobjects();



        DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TMamute);
        DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TPeixe);
        DisableGameObjects(MenuStatus.GetComponent <StatsBehaviour> ().TAguia);
        DisableGameObjects(MenuInject);
        DisableGameObjects(Aviso);
        DisableGameObjects(MenuStatus);

        fileName = "lastMonster.json";

        //String "master" It contains all the text for json file.
        string str = Read();

        //Still do not get it right what this means, but it is the variable that understands that the string is a json object.
        JSONNode json = JSON.Parse(str);

        //Get a string of monster choose, in laboratory
        LastMonster = json["monster_choose"];

        if (LastMonster == "Aguia")
        {
            LstAguia();
        }
        else if (LastMonster == "Mamute")
        {
            LstMamute();
        }
        else if (LastMonster == "Peixe")
        {
            LstPeixe();
        }
    }
コード例 #6
0
    public void Status()
    {
        DisableGameObjects(btnInjection);
        DisableGameObjects(btnStatus);
        CollidersDisable(rightArrow);
        CollidersDisable(leftArrow);

        EnableGameObjects(MenuStatus);
        if (LastMonster == "Aguia")
        {
            MenuStatus.GetComponent <StatsBehaviour> ().AguiaValues();
        }
        else if (LastMonster == "Mamute")
        {
            MenuStatus.GetComponent <StatsBehaviour> ().MamuteValues();
        }
        else if (LastMonster == "Peixe")
        {
            MenuStatus.GetComponent <StatsBehaviour>().PeixeValues();
        }

        MenuStatus.GetComponent <StatsBehaviour>().ShowValues();
    }
コード例 #7
0
    public void Inject()
    {
        if (LastMonster == "Aguia")
        {
            MenuStatus.GetComponent <StatsBehaviour> ().AguiaValues();
        }
        else if (LastMonster == "Mamute")
        {
            MenuStatus.GetComponent <StatsBehaviour> ().MamuteValues();
        }
        else if (LastMonster == "Peixe")
        {
            MenuStatus.GetComponent <StatsBehaviour>().PeixeValues();
        }

        if (ItemSelect == "item1")
        {
            itensbehaviour.item1 -= 1;
            tmpEner  = 50;
            tmpForca = 0;
            tmpResis = 0;
            tmpConst = 0;
            tmpTox   = 5;
            tmpVida  = 0;
        }
        else if (ItemSelect == "item2")
        {
            itensbehaviour.item2 -= 1;
            tmpEner  = 50;
            tmpForca = 1;
            tmpResis = 3;
            tmpConst = 0;
            tmpTox   = 40;
            tmpVida  = 0;
        }
        else if (ItemSelect == "item3")
        {
            itensbehaviour.item3 -= 1;
            tmpEner  = 0;
            tmpForca = 1;
            tmpResis = 3;
            tmpConst = 0;
            tmpTox   = 0;
            tmpVida  = 5;
        }
        else if (ItemSelect == "item4")
        {
            itensbehaviour.item4 -= 1;
            tmpEner  = 0;
            tmpForca = 0;
            tmpResis = 0;
            tmpConst = 0;
            tmpTox   = -20;
            tmpVida  = 0;
        }
        else if (ItemSelect == "item5")
        {
            itensbehaviour.item5 -= 1;
            tmpEner  = 0;
            tmpForca = 0;
            tmpResis = 0;
            tmpConst = 0;
            tmpTox   = 10;
            tmpVida  = 20;
        }
        else if (ItemSelect == "item6")
        {
            itensbehaviour.item6 -= 1;
            tmpEner  = 0;
            tmpForca = 5;
            tmpResis = 0;
            tmpConst = 1;
            tmpTox   = 70;
            tmpVida  = 0;
        }

        int damage           = MenuStatus.GetComponent <StatsBehaviour>().forc + tmpForca;
        int health           = MenuStatus.GetComponent <StatsBehaviour>().cons + tmpConst;
        int resistance       = MenuStatus.GetComponent <StatsBehaviour>().resis + tmpResis;;
        int energy           = MenuStatus.GetComponent <StatsBehaviour>().ener + tmpEner;
        int toxi             = MenuStatus.GetComponent <StatsBehaviour>().tox + tmpTox;
        int level            = MenuStatus.GetComponent <StatsBehaviour> ().level;
        int total_damage     = damage;
        int total_health     = MenuStatus.GetComponent <StatsBehaviour>().vida;
        int total_resistance = resistance;
        int total_energy     = energy;

        savechanges = new Monster_Create(total_damage, total_health, total_resistance, total_energy, damage, health, resistance, level, energy, toxi);
        playerJson  = JsonMapper.ToJson(savechanges);

        if (LastMonster == "Aguia")
        {
            File.WriteAllText((Application.persistentDataPath + "/Aguia.json"), playerJson.ToString());
        }
        else if (LastMonster == "Mamute")
        {
            File.WriteAllText((Application.persistentDataPath + "/Mamute.json"), playerJson.ToString());
        }
        else if (LastMonster == "Peixe")
        {
            File.WriteAllText((Application.persistentDataPath + "/Peixe.json"), playerJson.ToString());
        }


        itenssave  = new Itens(itensbehaviour.item1, itensbehaviour.item2, itensbehaviour.item3, itensbehaviour.item4, itensbehaviour.item5, itensbehaviour.item6);
        playerJson = JsonMapper.ToJson(itenssave);
        File.WriteAllText((Application.persistentDataPath + "/Itens.json"), playerJson.ToString());

        CollidersEnable(btnInjection);
        CollidersEnable(btnStatus);;
        EnableGameObjects(Monstros);
        if (LastMonster == "Aguia")
        {
            EnableGameObjects(Aguia);
        }
        else if (LastMonster == "Peixe")
        {
            EnableGameObjects(Fish);
        }
        else if (LastMonster == "Mamute")
        {
            EnableGameObjects(Mamute);
        }
        ItemInject.GetComponent <SpriteRenderer> ().sprite = null;
        ItemSelect = null;
        MenuInject.SetActive(false);
    }