示例#1
0
        // ReSharper disable once UnusedMember.Local
        protected virtual void OnCollisionEnter(Collision collision)
        {
            ICitizen citizenAgent = collision.GetContact(0).otherCollider.GetComponent <ICitizen>();

            if (citizenAgent == null)
            {
                return;
            }

            GameManager.CollisionsTotal++;
            if (IsSymptomatic)
            {
                GameManager.CollisionsSymptomatic++;
            }

            GameManager.Collisions[HealthStatus]++;

            if (!IsContagious)
            {
                return;
            }

            citizenAgent.Infect(GameManager.ChanceOfInfection);
            AddReward(-0.1f);
        }
示例#2
0
 protected override void OnCollisionEnter(Collision collision)
 {
     if (!_isDrivingAmbulance)
     {
         ICitizen citizenAgent = collision.GetContact(0).otherCollider.GetComponent <ICitizen>();
         if (citizenAgent != null)
         {
             if (citizenAgent.HealthStatus == HealthStatus.Infected && citizenAgent.IsSymptomatic)
             {
                 citizenAgent.StopInfectionProcess();
                 GameManager.HealedCounter++;
                 AddReward(0.4f);
             }
             if (IsContagious)
             {
                 citizenAgent.Infect(GameManager.ChanceOfInfection);
             }
         }
     }
 }