Exemple #1
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.transform.tag == "food")
     {
         Destroy(col.gameObject);
         SetReward(1f);
         //AddReward(1f);
         FoodManager.foodnum--;
         if (FoodManager.foodnum <= 200)
         {
             //InvokeRepeating("BuildFood", 0, 1);
             fm.BuildFood();
             FoodManager.foodnum++;
         }
     }
     if (col.transform.tag == "badfood")
     {
         Destroy(col.gameObject);
         SetReward(-1f);
         //AddReward(-1f);
         FoodManager.badfoodnum--;
         if (FoodManager.badfoodnum <= 50)
         {
             //InvokeRepeating("BuildBadFood", 0, 1);
             fm.BuildBadFood();
             FoodManager.badfoodnum++;
         }
     }
 }