Esempio n. 1
0
    public bool verificationCondition()
    {
        bool verifCondition = !debloque;

        if (previousSkills.Length != 0)
        {
            for (int i = 0; i < previousSkills.Length; i++)
            {
                SkillOverview current = (SkillOverview)previousSkills.GetValue(i);
                //verif condition
                if (!current.IsUnlocked())
                {
                    verifCondition = false;
                }
            }
        }

        int pointTotal = int.Parse(pointComp.text);

        if (pointTotal < cost)
        {
            verifCondition = false;
        }

        return(verifCondition);
    }
Esempio n. 2
0
    public void Sauvegarder()
    {
        string competenceProgression = "";
        string competenceResistance  = "";

        PlayerPrefs.SetInt("pc", point);
        PlayerPrefs.SetFloat("tl", timeLeftCompetence);

        SetCotamination("cAf", contaminationAfrique);
        SetCotamination("cAmN", contaminationAmeriqueNord);
        SetCotamination("cAmS", contaminationAmeriqueSud);
        SetCotamination("cAs", contaminationAsie);
        SetCotamination("cEu", contaminationEurope);
        SetCotamination("cOc", contaminationOceanie);

        PlayerPrefs.SetFloat("tLpch", timeLeftPatch);
        PlayerPrefs.SetFloat("dltTP", deltaTimePatch);
        PlayerPrefs.SetFloat("cntm", progressionContamination);

        SkillOverview[] compPropagation = propagation.GetComponentsInChildren <SkillOverview>(true);
        SkillOverview[] compResistance  = resistance.GetComponentsInChildren <SkillOverview>(true);

        for (int i = 0; i < compPropagation.Length; i++)
        {
            SkillOverview current = (SkillOverview)compPropagation.GetValue(i);
            //verification de l'achat de la competence
            if (!current.IsUnlocked())
            {
                competenceProgression = string.Concat(competenceProgression, "0");
            }
            else
            {
                competenceProgression = string.Concat(competenceProgression, "1");
            }
        }
        PlayerPrefs.SetString("cPr", competenceProgression);

        for (int i = 0; i < compResistance.Length; i++)
        {
            SkillOverview current = (SkillOverview)compResistance.GetValue(i);
            //verification de l'achat de la competence
            if (!current.IsUnlocked())
            {
                competenceResistance = string.Concat(competenceResistance, "0");
            }
            else
            {
                competenceResistance = string.Concat(competenceResistance, "1");
            }
        }
        PlayerPrefs.SetString("cRe", competenceResistance);
        PlayerPrefs.SetInt("prt", 1);
        SceneManager.LoadScene("Menu");
    }
Esempio n. 3
0
    public void ShowDescription()
    {
        bool verifCondition = !debloque;

        descWindow.text      = textDescription.text;
        conditionWindow.text = "";

        if (!debloque)
        {
            conditionWindow.text = "Pré-requis :";

            if (previousSkills.Length == 0)
            {
                conditionWindow.text += " Aucun\n";
            }
            else
            {
                conditionWindow.text += "\n";
                for (int i = 0; i < previousSkills.Length; i++)
                {
                    SkillOverview current = (SkillOverview)previousSkills.GetValue(i);
                    conditionWindow.text += "- " + current.name + "\n";
                    //verif condition
                    if (!current.IsUnlocked())
                    {
                        verifCondition = false;
                        //print("prev not unlock : " + current.IsUnlocked());
                    }
                }
            }
            int pointTotal = int.Parse(pointComp.text);
            if (pointTotal < cost)
            {
                verifCondition = false;
                //print("pas assez de point");
            }
        }

        controller.SelectCompetence(competence, this, cost, debloque, verifCondition);
    }