Ejemplo n.º 1
0
    public void EndDayResult()
    {
        //canInfect = false;
        CalculatePotentials();

        if (currentState == InfectionType.PreSymptomaticInfection)
        {
            daySinceInfection++;
            if (daySinceInfection >= daysUntilFullInfection)
            {
                currentState = InfectionType.FullyInfected;
                CheckInfection();
                manager.presymptomaticInfected--;
            }
        }
        else if (currentState == InfectionType.AsymptomaticInfection)
        {
            daySinceInfection++;
            if (daySinceInfection >= daysUntilCured)
            {
                currentState = InfectionType.NotInfected;
                CheckInfection();
                manager.asymptomaticInfected--;
            }
        }
        else if (currentState == InfectionType.FullyInfected)
        {
            currentState = InfectionType.Sick;
            manager.sick++;
            manager.fullyInfected--;
            GameManager._instance.people.Remove(this.gameObject);

            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 2
0
    public void SpecifyInfectionType() //change infection from healthy to ill
    {
        var infectionTypeProbability = UnityEngine.Random.Range(0f, 1f);

        if (infectionTypeProbability < 0.5f)
        {
            InfectionType = InfectionType.InfectedWithoutSymptoms;
        }
        else if (infectionTypeProbability < 0.96f)
        {
            InfectionType = InfectionType.InfectedWithSymptoms;
        }
        else
        {
            InfectionType = InfectionType.SeriouslyIll;
        }
    }
Ejemplo n.º 3
0
    void GetInfected(GameObject other)
    {
        Infection otherInfection = other.gameObject.GetComponent <Infection>();

        if (otherInfection != null && other.GetType() != typeof(SphereCollider) && otherInfection.canInfect == true && currentState == InfectionType.NotInfected)
        {
            //If other person is infected AND you are not infected
            if (otherInfection.currentState != InfectionType.NotInfected)
            {
                currentState = InfectionType.PotentialInfection;
                //manager.potentialInfected++;
                manager.notInfected--;

                CheckInfection();
            }
        }
    }
Ejemplo n.º 4
0
    public void CalculatePotentials()
    {
        if (currentState == InfectionType.PotentialInfection)
        {
            int RNG = Random.Range(0, 100);

            //50% chance they turn infected, 50% they are not infected.
            int ceilingRNG = 50;

            //35% chance to spread with mask.
            if (maskOn == true)
            {
                ceilingRNG = 35;
            }
            if (RNG < ceilingRNG)
            {
                int RNG2 = Random.Range(0, 100);
                //40% chance they turn asymptomatic
                ceilingRNG = 40;

                if (RNG2 < ceilingRNG)
                {
                    daysUntilCured = Random.Range(1, 7);
                    currentState   = InfectionType.AsymptomaticInfection;
                    manager.potentialInfected--;
                    manager.asymptomaticInfected++;
                }
                //60% to be fully infected within 7 days.
                else
                {
                    daysUntilFullInfection = Random.Range(1, 12);
                    currentState           = InfectionType.PreSymptomaticInfection;
                    manager.potentialInfected--;
                    manager.presymptomaticInfected++;
                }
            }
            else
            {
                currentState = InfectionType.NotInfected;
                manager.potentialInfected--;
                manager.notInfected++;
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Method used to decrement the infection level of a specific infectioin type for a given world.
 /// </summary>
 /// <param name="type">Type of infection to decrement</param>
 /// <param name="world">World to decrement the infection level in</param>
 /// <param name="amount">Amount to decrease the infection level</param>
 /// <returns>New infection level of the given infection type</returns>
 public int DecrementInfection(InfectionType type, int world, int amount)
 {
     return(_infectionStatus[(int)type, world] -= amount);
 }
Ejemplo n.º 6
0
 protected Guid AddInfection(string name, string code, string description, InfectionType type)
 {
     var  infection = new Infection(Guid.NewGuid())
     {
         Name = name,
        Code = code,
        InfectionType = type,
        Description = description
     };
     infection._SetStatus(EntityStatus.Active);
     return _InfectionRepository.Save(infection);
 }