Exemplo 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);
    }
Exemplo n.º 2
0
 public void SelectCompetence(GameObject competence, SkillOverview overviewSkill, int coutCompetence, bool debloque, bool conditionVerifier)
 {
     //print("cout : " + coutCompetence + " debloque : " + debloque + " conditionVerif : " + conditionVerifier);
     activeSkill = competence;
     activeView  = overviewSkill;
     skillCost   = coutCompetence;
     unlock.SetActive(!debloque);
     unlockButton.interactable = conditionVerifier;
     unlockText.text           = ("Coût : " + coutCompetence);
 }
Exemplo n.º 3
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");
    }
Exemplo n.º 4
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);
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        if (PlayerPrefs.GetInt("ld") == 0)
        {
            point = 3;
            timeLeftCompetence = 10.0f;
            tutoriel.SetActive(true);

            //nombre de support contamine pc / telephones / objets connectés
            contaminationAfrique = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            contaminationAmeriqueNord = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            contaminationAmeriqueSud = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            contaminationAsie = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            contaminationEurope = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            contaminationOceanie = new float[3] {
                0.0f, 0.0f, 0.0f
            };
            //total nombre de supports contaminés par continent
            contaminationTotAfrique      = 0.0f;
            contaminationTotAmeriqueNord = 0.0f;
            contaminationTotAmeriqueSud  = 0.0f;
            contaminationTotAsie         = 0.0f;
            contaminationTotEurope       = 0.0f;
            contaminationTotOceanie      = 0.0f;

            progressionPatch         = 0.0f;
            progressionContamination = 0.0f;

            pc      = 0.0f;
            tel     = 0.0f;
            objetCo = 0.0f;

            deltaTimePatch = 0.0f;
        }
        else
        {
            Charger();
        }

        newTimeLeftCompetence = timeLeftCompetence;
        totalAsie             = somme(objetAsie);
        totalAfrique          = somme(objetAfrique);
        totalAmeriqueNord     = somme(objetAmeriqueNord);
        totalAmeriqueSud      = somme(objetAmeriqueSud);
        totalEurope           = somme(objetEurope);
        totalOceanie          = somme(objetOceanie);
        total = totalAfrique + totalAmeriqueNord + totalAmeriqueSud + totalAsie + totalEurope + totalOceanie;
        menu.SetActive(false);
        ecranDefaite.SetActive(false);
        ecranVictoire.SetActive(false);
        afficherPoint();
        activeSkill = null;
        skillCost   = 0;
        unlock.SetActive(false);
        premierAchat       = false;
        activeView         = null;
        currentInformation = null;
    }