Example #1
0
    public void Update()
    {
        if (_hasBeenDelivered)
        {
            return;
        }

        if (!HasCollided && Vector2.Distance(transform.position, GameobjectToReceive.transform.position) < DistanceForCollision)
        {
            HasCollided = true;
        }

        if (HasCollided)
        {
            FindObjectOfType <AudioManager>().PlaySound("Item placed right");
            SaveHandler.SaveLevel("Pipe[image]", "HasBeenDelivered", true);

            if (Popup)
            {
                Popup.ClosePopupMenu();
            }

            Destroy(GameobjectToReceive);
        }
    }