Beispiel #1
0
    protected override void onStart()
    {
        unreadMessages       = chatContent.transform.GetChild(0);
        playerMessagePrefab  = chatContent.GetComponent <ChatPrefabs>().PlayerMessage;
        advisorMessagePrefab = chatContent.GetComponent <ChatPrefabs>().AdvisorMessage;
        panelAnimator        = chatContent.GetComponentInParent <Animator>();
        scrollRect           = chatContent.GetComponentInParent <ScrollRect>();

        // Récupération de l'échelle de temps
        time = simulationData.GetComponent <TimeScale>();
        // Récupération de données de la frontière
        frontierPermeability = simulationData.GetComponent <FrontierPermeability>();
        // Récupération de données des impôts de entreprises
        tax = simulationData.GetComponent <Tax>();
        // Récupération de données du télétravail
        remoteworking = simulationData.GetComponent <Remoteworking>();
        // Récupération de données du chômage partiel
        shortTimeWorking = simulationData.GetComponent <ShortTimeWorking>();
        // Récupération des masques
        masks = simulationData.GetComponent <Masks>();
        // Récupération des données du vaccin
        vaccine = simulationData.GetComponent <Vaccine>();

        f_chatMessage.addEntryCallback(OnNewMessage);
    }
Beispiel #2
0
 protected override void onStart()
 {
     // Récupération de l'échelle de temps
     time = countrySimData.GetComponent <TimeScale>();
     // Récupération de données de la frontière
     frontierPermeability = countrySimData.GetComponent <FrontierPermeability>();
     // Récupération du stress de la population
     revolution = countrySimData.GetComponent <Revolution>();
     // Récupération des données de la population
     countryPopData = countrySimData.GetComponent <TerritoryData>();
     // Récupération des données du télétravail
     remoteworking = countrySimData.GetComponent <Remoteworking>();
     // Récupération des données du chômage partiel
     shortTimeWorking = countrySimData.GetComponent <ShortTimeWorking>();
     // Récupération des données du soutien aux entreprises
     tax = countrySimData.GetComponent <Tax>();
     // Récupération des données des masques
     masks = countrySimData.GetComponent <Masks>();
 }
Beispiel #3
0
 protected override void onStart()
 {
     // Récupération de l'échelle de temps
     time = countrySimData.GetComponent <TimeScale>();
     // Récupération des données de la population
     countryPopData = countrySimData.GetComponent <TerritoryData>();
     // Récupération de données de la frontière
     frontierPermeability = countrySimData.GetComponent <FrontierPermeability>();
     // Récupération des finances
     finances = countrySimData.GetComponent <Finances>();
     // Récupération de données du télétravail
     remoteworking = countrySimData.GetComponent <Remoteworking>();
     // Récupération de données du chômage partiel
     shortTimeWorking = countrySimData.GetComponent <ShortTimeWorking>();
     // Récupération de données des impôts de entreprises
     tax = countrySimData.GetComponent <Tax>();
     // Récupération de données des lits de réanimation
     beds = countrySimData.GetComponent <Beds>();
     finances.historySpent.Add(0);
 }
Beispiel #4
0
    protected override void onStart()
    {
        // Récupération des stats du virus
        virusStats = countrySimData.GetComponent <VirusStats>();
        // Récupération des données de la population
        countryPopData = countrySimData.GetComponent <TerritoryData>();
        // Récupération de l'échelle de temps
        time = countrySimData.GetComponent <TimeScale>();
        // Récupération des masques
        masks = countrySimData.GetComponent <Masks>();
        // Récupération de l'impact du confinement
        confinementImpact = countrySimData.GetComponent <InfectionImpact>();
        // Récupération de données de la frontière
        frontierPermeability = countrySimData.GetComponent <FrontierPermeability>();
        // Récupération de données du télétravail
        remoteworking = countrySimData.GetComponent <Remoteworking>();

        // calcul de la courbe de contagiosité pour une fenêtre de jours
        contagiousnessProbabilityPerDays = new float[virusStats.windowSize];
        float peak      = virusStats.contagiousnessPeak;
        float deviation = virusStats.contagiousnessDeviation;

        for (int i = 0; i < contagiousnessProbabilityPerDays.Length; i++)
        {
            contagiousnessProbabilityPerDays[i] = (1 / (deviation * Mathf.Sqrt(2 * Mathf.PI))) * Mathf.Exp(-((i - peak) * (i - peak)) / (2 * deviation * deviation));
        }

        TerritoryData territoryData;

        foreach (GameObject territory in f_territoriesAndCountry)
        {
            territoryData = territory.GetComponent <TerritoryData>();
            // Initialisation du nombre d'infectés pour chaque jour de la fenêtre
            territoryData.numberOfInfectedPeoplePerDays = new int[virusStats.windowSize];
            for (int day = 0; day < virusStats.windowSize; day++)
            {
                territoryData.numberOfInfectedPeoplePerDays[day] = 0;
            }
            // Initialisation du nombre d'infectés pour chaque age et pour chaque jour de la fenêtre
            territoryData.numberOfInfectedPeoplePerAgesAndDays = new int[territoryData.popNumber.Length][];
            for (int age = 0; age < territoryData.popNumber.Length; age++)
            {
                territoryData.numberOfInfectedPeoplePerAgesAndDays[age] = new int[virusStats.windowSize];
                for (int day = 0; day < virusStats.windowSize; day++)
                {
                    territoryData.numberOfInfectedPeoplePerAgesAndDays[age][day] = 0;
                }
            }
        }

        // Pour déterminer la contagiosité du virus on doit trouver le polynome qui passe par trois points :
        //   - si % population infecté == 0 => contagiosité par défaut du virus
        //   - si % population infecté == % d'immunité => contagiosité == 1
        //   - si % population infecté == 1 => contagiosité == 0
        // On doit donc trouver les valeurs a, b et c du polynome aX²+bX+c=Y avec X <=> % de population infecté et Y la contagiosité finale
        // Donc on doit résoudre le système
        //   --
        //   | a*0² + b*0 + c = contagVirus
        //   | a*immu² + b*immu + c = 1
        //   | a*1² + b*1 + c = 0
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² + b*immu + contagVirus = 1
        //   | a + b = -contagVirus
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² + b*immu + contagVirus = 1
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² + (-contagVirus - a)*immu + contagVirus = 1
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² - contagVirus*immu -a*immu + contagVirus = 1
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² - a*immu = 1 + contagVirus*immu - contagVirus
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a*immu² - a*immu = 1 + (immu - 1) * contagVirus
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a * (immu² - immu) = 1 + (immu - 1) * contagVirus
        //   | b = -contagVirus - a
        //   --
        //   --
        //   | c = contagVirus
        //   | a = (1 + (immu - 1) * contagVirus) / (immu² - immu)
        //   | b = -contagVirus - a
        //   --
        // Prise en compte des cas limites
        if (virusStats.populationRatioImmunity <= 0)
        {
            polyA = 0;
            polyC = 0;
            polyB = 0;
        }
        else if (virusStats.populationRatioImmunity >= 1)
        {
            polyA = 0;
            polyC = virusStats.contagiosity;
            polyB = 0;
        }
        else
        {
            polyC = virusStats.contagiosity;
            polyA = (1 + (virusStats.populationRatioImmunity - 1) * virusStats.contagiosity) / (virusStats.populationRatioImmunity * virusStats.populationRatioImmunity - virusStats.populationRatioImmunity);
            polyB = -polyC - polyA;
        }
    }