My version

Know Python a little, so when heard lection task, paused the video and tried to do it by myself…
Your opinion?

public class PickUp : MonoBehaviour
{
   public static int countPackage = 0;// Подобранная коробка
private void OnTriggerEnter2D(Collider2D other) 
{

    if (countPackage == 0)
    {
        countPackage++;
        Debug.Log("You picked Package!");

    }else if (countPackage >= 1)
    {
        Debug.Log("You already picked Package!");
    }
}
}

and

public class Reciver : MonoBehaviour
{
    private void OnTriggerEnter2D(Collider2D other) {
       if (PickUp.countPackage == 1)
       {
           PickUp.countPackage--;
           Debug.Log("You Delivered package, get ur money and go away.");
       }else if(PickUp.countPackage == 0)
       {
        Debug.Log("Where's pizza?! u don't get any money untill I get ma pizza!");
       }
    }
}

1 Like

Pizza Time :pizza:

Privacy & Terms