Пример #1
0
    protected override void OnDragDropRelease(GameObject surface)
    {
        if (surface != null)
        {
            if (surface.GetComponent <ZoneView>() == null)
            {
                surface = null;
            }
            else
            {
                Zone possibleZone = surface.GetComponent <ZoneView>().zoneModel;
                if (possibleZone && !possibleZone.queueOpen)
                //if (!surface.GetComponent<Zone>().queueOpen)
                //If queue is full, send the customer object back.
                {
                    surface = null;
                }
            }

            //else if (possibleZone)
            //{
            //    possibleZone.zoneViews[0].OnDrop(gameObject);
            //    return;
            //}
        }
        base.OnDragDropRelease(surface);

        dragging = false;
        customerView.EndDrag();
        RaycastHit[] hits = RaycastForZones();
        if (hits.Length > 0)
        {
            foreach (RaycastHit hit in hits)
            {
                if (hit.collider.name == "Fader" || hit.collider.name == "Zoner")
                {
                    return;
                }
            }
            ZoneView possibleZoneView = hits[0].collider.GetComponent <ZoneView>();
            possibleZoneView.OnCustomDrop(gameObject);
        }
        else
        {
            AudioManager.instance.CustomerReleased();
        }
    }
Пример #2
0
    public void Die()
    {
        //Customer dies while in zone...
        if (currentZone != null)
        {
            //Zone takes care of zonepanel removing too, so this all we need if the customer is in a zone.
            currentZone.CustomerDeadInQueue(this);
        }
        //customer dies while in queue...
        else
        {
            //foreach (Transform customerViewTrans in God.instance.customersQueue.transform)
            //{
            //    CustomerView customerView = customerViewTrans.GetComponent<CustomerView>();
            //    if (customerView.customerModel == this)
            //    {
            // THIS SHOULD ALL BE MOVED IN CUSTOMERVIEW...
            if (customerView.gameObject)
            {
                if (customerView.GetComponent <DragDropCustomer>().dragging)
                {
                    //This is so if the customer dies of running out of time when dragged, all looks good.
                    customerView.EndDrag();
                    customerView.DestroyCustomerView();
                }
                else// Customer is still in the queue
                {
                    customerView.DestroyCustomerView(new System.Action(() => God.instance.customersQueue.GetComponent <UIGrid>().repositionNow = true));
                }
            }
            //    }
            //}
        }

        God.instance.CustomerLost(this);
    }