Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (GameObject.FindGameObjectsWithTag("SelectedFoyer") != null || GameObject.FindGameObjectsWithTag("SelectedFoyer").Length != 0)
        {
            foyer             = (InfectedScript)GameObject.FindGameObjectsWithTag("SelectedFoyer")[0].GetComponent("InfectedScript");
            washingHands      = foyer.getWashingHands();
            quarantineRespect = foyer.getQuarantineRespect();
            masks             = foyer.getMasks();
            nameFoyer         = foyer.getNameFoyer();

            libelleNameFoyer        = this.transform.GetChild(0).GetComponentInChildren <Text>();
            tauxQuarantineRespect   = this.transform.GetChild(1).GetComponentInChildren <Text>();
            tauxMasks               = this.transform.GetChild(2).GetComponentInChildren <Text>();
            tauxWashingHands        = this.transform.GetChild(3).GetComponentInChildren <Text>();
            sliderQuarantineRespect = this.transform.GetChild(4).GetComponentInChildren <Slider>();
            sliderMasks             = this.transform.GetChild(5).GetComponentInChildren <Slider>();
            sliderWashingHands      = this.transform.GetChild(6).GetComponentInChildren <Slider>();

            libelleNameFoyer.text      = nameFoyer;
            tauxQuarantineRespect.text = quarantineRespect.ToString();
            tauxWashingHands.text      = washingHands.ToString();
            tauxMasks.text             = masks.ToString();

            sliderQuarantineRespect.value = quarantineRespect / 100f;
            sliderWashingHands.value      = washingHands / 100f;
            sliderMasks.value             = masks / 100f;
        }
    }
Beispiel #2
0
    public float Increment()
    {
        //Debug.Log("pouet" + infectedScript.getMasks());
        float risqueTotal;

        risqueTotal = ((risqueAvecMasque * (infectedScript.getMasks() / 1000)) + (risqueSansMasque * (1 - (infectedScript.getMasks() / 1000))) + (risqueAvecGel * (infectedScript.getWashingHands() / 1000)) + (risqueSansGel * (1 - (infectedScript.getWashingHands() / 1000))) + (risqueAvecConfinement * (infectedScript.getQuarantineRespect() / 1000)) + (risqueSansConfinement * (1 - (infectedScript.getQuarantineRespect() / 1000)))) / 30;
        //Debug.Log("Risque total : " + risqueTotal + "%");
        maxIncrementValue = risqueTotal; // La vitesse d'augmentation maximale correspond au risque d'atrapper le virus (ex : si 100% de risque, 100% du foyer va finir contaminé très rapidement)

        infectedScript.infectionRate += Random.Range(0, maxIncrementValue);
        if (infectedScript.infectionRate > 100)
        {
            infectedScript.infectionRate = 100;
        }
        //Invoke("Increment", 10f);
        return(risqueTotal);
    }