Exemple #1
0
 private void Update()
 {
     if (deltaTime > scanFrequency)
     {
         var cols = Physics.OverlapBox(gameObject.transform.position, new Vector3(1.5f, 1.5f, 1.5f), transform.rotation);
         foreach (var c in cols)
         {
             Citizen citizen = c.GetComponent <Citizen>();
             if (c.gameObject.layer == 8 && citizen.CitizenType == CitizenType.Latent)
             {
                 //临时减少感染概率代码
                 if (type == 1)
                 {
                     citizen.InfectRate -= 0.5f;
                 }
                 //检测潜伏期的代码
                 else
                 {
                     citizen.CheckReavel();
                 }
             }
         }
         deltaTime = 0;
     }
     deltaTime += Time.deltaTime;
     existTime += Time.deltaTime;
     if (existTime > DestoryTime && type != 3)
     {
         Destroy(gameObject);
     }
 }