Пример #1
0
    private void HandleHaulJobResult(object source, EventArgs e)
    {
        if (_wasConstructionCanceled)
        {
            return;
        }

        if (source is HaulToItemHolderJob)
        {
            HaulToItemHolderJob job = source as HaulToItemHolderJob;
            bool result             = (e as Job.JobResultEventArgs).result;
            if (result == true)
            {
                job.JobResultHandler -= HandleHaulJobResult;
                _jobs.Remove(job);
                CalculateNewIngredientsValues((source as HaulToItemHolderJob).Item);
                //think of a better solution, also don't forget to stop coroutine in case the job gets canceled
                _waitUntilCharacterMovesFromTheTile = GameManager.GetInstance().StartCoroutine(ChangePlanToActiveState());
            }
            else
            {
                CreateHaulingJobForIngredient(job.ItemType);
            }
        }
    }
Пример #2
0
    private void CreateHaulingJobForIngredient(Type ingredientType)
    {
        HaulToItemHolderJob job = new HaulToItemHolderJob(ingredientType, this);

        JobSystem.GetInstance().AddJob(job);
        _jobs.Add(job);
        job.JobResultHandler += HandleHaulJobResult;
    }