public static void AddElement(Elements element) { UIManager.ClearCreatureName(); ErrCodesAlchemy check = receipt.AddElement(element); if (check != ErrCodesAlchemy.success) { //UIManager.LogErrorMessage(check); UIManager.ShowErrorMessage(check); return; } UIReceiptTable.UpdateTable(); }
public void RemoveElement(Elements element) { Ingredient removed = GetIngredient(element); if (removed != null) { removed.portion--; if (removed.portion == 0) { ingredients.Remove(removed); } } UIReceiptTable.UpdateTable(); }
public ErrCodesAlchemy AddElement(Elements element) { #region 3 правило Алхимии: Антипатия // Желчь не смешивается с Пеплом, Кости не смешиваются с Мраком; // только Кровь может смешиваться с любым другим элементом. foreach (var ingredient in ingredients) { if ((ingredient.element == Elements.bone && element == Elements.shadow) || (ingredient.element == Elements.shadow && element == Elements.bone)) { return(ErrCodesAlchemy.BoneContrShadow); } else if ((ingredient.element == Elements.cinder && element == Elements.slime) || (ingredient.element == Elements.slime && element == Elements.cinder)) { return(ErrCodesAlchemy.SlimeContrCinder); } } #endregion #region Проверка уровня Игрока int sum = GetSum(); if (sum >= Player.level + 2) { return(ErrCodesAlchemy.notEnoughLevel); } #endregion Ingredient added = GetIngredient(element); if (added != null) { added.portion++; } else { ingredients.Add(new Ingredient(element)); } UpdateIngredients(); UIReceiptTable.UpdateTable(); return(ErrCodesAlchemy.success); }
public static void ConfirmReceipt() { int sum = receipt.GetSum(); if (sum == 0) { return; } ErrCodesAlchemy check = CheckReceiptFinal(); if (check == ErrCodesAlchemy.success) { GetPerksFromReciept(out Perk perk1, out Perk perk2); Unit unitType = GetUnitFromReceipt(); if (perk2 == null) { UIManager.ShowCreatureName(unitType.unitName, perk1); } else { UIManager.ShowCreatureName(unitType.unitName, perk1, perk2); } Player.SpawnUnit(unitType, perk1, perk2); AnimateCauldron(); ClearReceipt(); UIReceiptTable.UpdateTable(); } else { UIManager.ShowErrorMessage(check); } }
void Awake() { local = this; elementsButtons = new List <ButtonAlchemy>(); }
public static void ClearReceipt() { receipt.ingredients.Clear(); receipt.Clear(); UIReceiptTable.ClearTable(); }
public static void RemoveElement(Elements element) { receipt.RemoveElement(element); UIReceiptTable.UpdateTable(); }