Пример #1
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);
    }