Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log("OnTriggerEnter2D");
     if (collision.name.StartsWith("Food"))
     {
         ate = true;
         Destroy(collision.gameObject);
         SpawnFood.EatOne();
     }
     else
     {
         GameController.FailGame();
         audioSource2.clip = audioClips [3];
         audioSource2.Play();
     }
 }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log("OnTriggerEnter2D");
     //CAN BE IMPROVE WITH TAG PROPERTY
     if (collision.name.StartsWith("Food"))
     {
         ate = true;
         Destroy(collision.gameObject);
         SpawnFood.EatOne();
     }
     else if (collision.tag.Contains("Border"))
     {
         GameController.FailGame();
         //TODO:YOU LOSE SCREEN
     }
 }