Esempio n. 1
0
    public void OnDrawGizmos()
    {
        Gizmos.color = Color.red;

        float rad = SimLib.ConvertToInGameLength(sim.socialDistanceLength);

        Gizmos.DrawWireSphere(transform.position - new Vector3(0, 1, 0), rad);
    }
Esempio n. 2
0
    private void Update()
    {
        DisplayInfectionStatus();

        // Infected
        if (status != InfectionStatus.NotInfected)
        {
            if (infectionTimer > InfectionCd)
            {
                infectionTimer = 0;

                nearbyPeople = SimLib.FindNearbyPeople(gameObject, SimLib.ConvertToInGameLength(sim.socialDistanceLength));

                // Attempt to infect the noninfected
                foreach (GameObject p in nearbyPeople)
                {
                    if (p.GetComponent <Covid>().status == InfectionStatus.NotInfected)
                    {
                        float perc = Random.Range(0f, 1f);

                        // Mask modifier
                        float maskMod = 1f;
                        if (p.GetComponent <Person>().isUsingMask)
                        {
                            maskMod = 1 - sim.maskInfectionReductionRate;
                        }

                        if (perc <= sim.infectionRate * maskMod)
                        {
                            Infect(p);
                        }
                    }
                }
            }

            // Recover if asymptomatic
            if (status == InfectionStatus.Asymptomatic)
            {
                if (asymptomaticRecoveryTimer > sim.asymptomaticRecoveryTime * sim.secondsInDay)
                {
                    status = InfectionStatus.NotInfected;
                    sim.numRecovered++;
                    Debug.Log("Recovered");
                }
                asymptomaticRecoveryTimer += Time.deltaTime;
            }

            infectionTimer += Time.deltaTime;
        }
        // Not infected
        else
        {
            infectionTimer            = 0;
            asymptomaticRecoveryTimer = 0;
        }
    }
Esempio n. 3
0
 /// <summary>
 /// Instructs the program to proceed execution
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="eqea"></param>
 private static void Proceed(Object sender, SimLib.Abstractions.Networking.Com<IMessage>.EmptyQueueEventArgs eqea)
 {
     mainThread.Interrupt();
 }