Example #1
0
    public void BeginWorkOrder(WorkOrder workOrder)
    {
        if (!resourcesManager.TryPay(workOrder.cost))
        {
            ErrorManager.Instance.ShowError("Insufficient resources!");
            return;
        }

        workOrderQueue.Enqueue(workOrder);
        OnWorkOrderQueueUpdated?.Invoke(workOrderQueue.GetReadonlyList());

        if (!Working)
        {
            StartCoroutine(Work());
        }
    }