static void changeAmount(int delta) { if (delta == 0 || currentCraftAmount == 0) { return; } if ((currentCraftAmount == 1 && delta == -1) || (currentCraftAmount == currentCraftAmountMax && delta == 1)) { return; } currentCraftAmount += delta; TechInfo.Ing[] ingsCurrent = originalTechInfo.ingredients.Select(ing => new TechInfo.Ing(ing.techType, ing.amount * currentCraftAmount)).ToArray(); currentTechInfo = new (ingsCurrent) { craftAmount = originalCraftAmount * currentCraftAmount, linkedItems = new (originalTechInfo.linkedItems) }; TechInfoUtils.setTechInfo(currentTechType, currentTechInfo); } }
static void reset() { if (originalTechInfo != null) { TechInfoUtils.setTechInfo(currentTechType, originalTechInfo); } currentTechType = TechType.None; originalTechInfo = currentTechInfo = null; }
static void init(TechType techType) { currentCraftAmount = 0; TechInfo techInfo = TechInfoUtils.getTechInfo(techType); currentCraftAmountMax = getMaxAmount(techInfo); if (currentCraftAmountMax == 0) { return; } currentCraftAmount = 1; currentTechType = techType; originalTechInfo = techInfo; currentTechInfo = new TechInfo(techInfo); }