private void Update() { foreach (var item in pipeline.input) { if (item == null) { continue; } if (item.Spoil()) { OnWorkAreaUpdate?.Invoke(this); } } foreach (var item in pipeline.output) { if (item == null) { continue; } if (item.Spoil()) { OnWorkAreaUpdate?.Invoke(this); } } if (waitors.Count > 0) { OnCanvasUpdate?.Invoke(); } }
private void Update() { foreach (var item in items) { if (item == null) { continue; } if (item.Spoil()) { RefreshVisuals(); OnWorkAreaUpdate?.Invoke(this); } if (item.Unreturn()) { OnWorkAreaUpdate?.Invoke(this); } } if (waitors.Count > 0) { OnCanvasUpdate?.Invoke(); } }
public override List <DulibaWaitor.Command> GetCommands(DulibaWaitor waitor) { List <DulibaWaitor.Command> actions = new List <DulibaWaitor.Command>(); var recipeToDispense = GetRecipeToDispense(); if (recipeToDispense != null) { actions.Add(new DulibaWaitor.Command() { workTime = recipeToDispense.recipe.time, reflected = true, actionType = DulibaWaitor.ActionType.Pickup, name = "pickup " + recipeToDispense.name, image = recipeToDispense.recipe.output.image, pickupIndex = 0, shelf = new ItemDataWithCount(recipeToDispense.recipe.output, 0, 1, false, true), callback = () => { pipeline.Dispense(); }, lateCallback = () => { OnCanvasUpdate?.Invoke(); OnWorkAreaUpdate?.Invoke(this); } }); } if (pipeline.input != null && pipeline.inputAmount > 0) { actions.Add(new DulibaWaitor.Command() { workTime = 3f, actionType = DulibaWaitor.ActionType.Action, prerequisite = PreRequisite.BothHandsEmpty, name = "clean " + name, callback = () => { var garbageBag = new Carryable((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")); garbageBag.data.garbageValue += (int)(pipeline.input.data.garbageValue * pipeline.inputAmount); pipeline.Clean(); waitor.rightHand.SetItem(garbageBag); }, image = ((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")).image, lateCallback = () => { OnWorkAreaUpdate?.Invoke(this); } }); } return(actions); }
private void Update() { if (pipeline.input != null && pipeline.input.data.rottable && Time.time > pipeline.spoilageTimer) { var rot = new Item((ItemScriptableObject)DatabaseManager.GetItem("rot")); rot.data.garbageValue = pipeline.input.data.garbageValue; pipeline.input = rot; pipeline.recipe = null; OnWorkAreaUpdate?.Invoke(this); } if (waitors.Count > 0) { OnCanvasUpdate?.Invoke(); } }
public override List <DulibaWaitor.Command> CanInteractWithItem(Carryable item) { List <DulibaWaitor.Command> actions = new List <DulibaWaitor.Command>(); var recipeToDispense = GetRecipeToDispense(item); if (recipeToDispense != null) { if (recipeToDispense.recipe.packageOutput) { actions.Add(new DulibaWaitor.Command() { workTime = recipeToDispense.recipe.time, name = "prepare 6 " + recipeToDispense.recipe.output.name, image = recipeToDispense.recipe.output.image, item = new Package(recipeToDispense.recipe.output, 6), lateCallback = () => { OnCanvasUpdate?.Invoke(); OnWorkAreaUpdate?.Invoke(this); } }); } else { actions.Add(new DulibaWaitor.Command() { workTime = recipeToDispense.recipe.time, name = "prepare " + recipeToDispense.recipe.output.name, image = recipeToDispense.recipe.output.image, item = new Carryable(recipeToDispense.recipe.output), lateCallback = () => { OnCanvasUpdate?.Invoke(); OnWorkAreaUpdate?.Invoke(this); } }); } } return(actions); }
private void Update() { foreach (var pipe in pipeline) { if (pipe.input == null) { continue; } if (pipe.input is Item item) { pipe.input.Spoil(); OnWorkAreaUpdate?.Invoke(this); } } if (waitors.Count > 0) { OnCanvasUpdate?.Invoke(); } }
private void Update() { switch (orderStatus) { case OrderStatus.Deciding: if (Time.time > timeRemaining) { orderStatus = OrderStatus.Decided; patience = Time.time + Random.Range(40f, 60f); OnWorkAreaUpdate?.Invoke(this); } OnCanvasUpdate?.Invoke(); break; case OrderStatus.Eating: if (Time.time > timeRemaining) { orderStatus = OrderStatus.Paying; patience = Time.time + Random.Range(40f, 60f); OnWorkAreaUpdate?.Invoke(this); } OnCanvasUpdate?.Invoke(); break; case OrderStatus.Decided: case OrderStatus.Paying: case OrderStatus.Arrived: case OrderStatus.Taken: if (Time.time > patience) { CustomerManager.Instance.EmptyTable(this, false); orderStatus = OrderStatus.Empty; OnWorkAreaUpdate?.Invoke(this); } OnCanvasUpdate?.Invoke(); break; } }
public override List <DulibaWaitor.Command> GetCommands(DulibaWaitor waitor) { List <DulibaWaitor.Command> actions = new List <DulibaWaitor.Command>(); if (pipeline.craftingCoroutine != null) { actions.Add(new DulibaWaitor.Command() { workTime = 0.25f, actionType = DulibaWaitor.ActionType.Action, name = "stop crafting", callback = () => { InterruptCraft(); }, lateCallback = () => { OnWorkAreaUpdate?.Invoke(this); } }); } /* * else if (craftingStopped) * { * actions.Add(new DulibaWaitor.Command() * { * workTime = 3f, * actionType = DulibaWaitor.ActionType.Action, * prerequisite = PreRequisite.BothHandsEmpty, * name = "clean " + name, * callback = () => * { * var garbageBag = new Carryable((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")); * garbageBag.data.garbageValue = outputItems[0].data.garbageValue; * CleanMachine(); * waitor.rightHand.SetItem(garbageBag); * }, * image = ((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")).image, * lateCallback = () => * { * OnWorkAreaUpdate?.Invoke(this); * } * }); * }*/ else { for (int i = 0; i < pipeline.output.Count; i++) { var item = pipeline.output[i]; int temp = i; if (item != null) { actions.Add(new DulibaWaitor.Command() { workTime = 0.5f, reflected = true, actionType = DulibaWaitor.ActionType.Pickup, name = "pickup " + item.data.name, image = item.data.image, pickupIndex = temp, item = item, callback = () => { pipeline.output.Remove(item); }, lateCallback = () => { OnCanvasUpdate?.Invoke(); OnWorkAreaUpdate?.Invoke(this); } }); } } if (!HasItemsInOutput()) { var recipe = GetRecipe(); if (recipe != null) { ItemScriptableObject item = recipe.recipe.output[0].item; actions.Add(new DulibaWaitor.Command() { workTime = 0.25f, actionType = DulibaWaitor.ActionType.Action, name = "craft " + item.name, image = item.image, prerequisite = PreRequisite.None, pickupIndex = 0, callback = () => { Craft(recipe); }, lateCallback = () => { OnWorkAreaUpdate?.Invoke(this); } }); } } if (pipeline.input.Count > 0) { actions.Add(new DulibaWaitor.Command() { workTime = 3f, actionType = DulibaWaitor.ActionType.Action, prerequisite = PreRequisite.BothHandsEmpty, name = "clean " + name, callback = () => { var garbageBag = new Carryable((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")); foreach (var item in pipeline.input) { garbageBag.data.garbageValue += item.data.garbageValue; } CleanMachine(); waitor.rightHand.SetItem(garbageBag); }, image = ((ItemScriptableObject)DatabaseManager.GetItem("garbage_bag")).image, lateCallback = () => { OnWorkAreaUpdate?.Invoke(this); } }); } } return(actions); }