Пример #1
0
 public void AddContagiousPanda(Panda newContagousPanda)
 {
     ///<summary> this add a panda in paramater to the contagious list</summary>
     contagiousPandas.Add(newContagousPanda);
     numberOfContagiousPanda   += 1;
     numberOfContaminatedPanda += 1;
 }
Пример #2
0
        private void spreadingDisease(List <Panda> listPandas)
        ///<summary>
        ///For panda who are still contagious continue to spread the disease in the forest
        ///</summary>
        ///<param name="listStillContagiousPanda"> this will contains the list of pandas who can still contaminate other panda</param>
        {
            numberOfDay += 1;
            Panda[] currentContagiousPandas = new Panda[listPandas.Count];
            listPandas.CopyTo(currentContagiousPandas);

            foreach (Panda panda in currentContagiousPandas)
            {
                panda.Contaminate();
            }
        }
Пример #3
0
        public void ResetToZero()
        {
            ///<summary> restart all the contamination when you reset the app</summary>
            foreach (Panda panda in forest)
            {
                panda.KillIt();
            }

            forest                    = new List <Panda>();
            contagiousPandas          = new List <Panda>();
            numberOfContagiousPanda   = 0;
            numberOfContaminatedPanda = 0;
            numberOfDay               = 0;
            //Set patientZero to null
            patientZero        = null;
            confirmPatientZero = false;
        }
Пример #4
0
 private void Update()
 {
     ///This will raycast a ray and if it touch a panda this one will be selected
     if (!confirmPatientZero && Input.GetMouseButtonDown(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             if (hit.collider.tag == "Panda")
             {
                 if (patientZero != null)
                 {
                     patientZero.Unselect();
                 }
                 patientZero = hit.collider.gameObject.GetComponent <Panda>();
                 patientZero.IsSelected();
             }
         }
     }
 }
Пример #5
0
 public void RemoveContagiousPanda(Panda curedPanda)
 {
     ///<summary> this remove panda in paramater to the contagious list</summary>
     contagiousPandas.Remove(curedPanda);
     numberOfContagiousPanda -= 1;
 }