private void setActionMsgForBuff (Buff buff) { if (buff.isUsed()) { errorMsgTrans.gameObject.SetActive(false); actionMsgTrans.gameObject.SetActive(false); costTrans.localPosition = costPos_1; } else { if (!buff.isHavingTargetItem()) { errorMsg.text = (buff.getBuffItemType() == BuffItemType.SHIELD)? "Надень щит": (buff.getBuffItemType() == BuffItemType.ARMOR)? "Надень броню": (buff.getBuffItemType() == BuffItemType.WEAPON)? "Возьми оружие": "Я ХЗ что происходит("; costTrans.localPosition = costPos_2; errorMsgTrans.gameObject.SetActive(true); actionMsgTrans.gameObject.SetActive(false); minY += .5f; } else if (Vars.gold >= buff.getCost()) { actionMsg.text = "Чары"; costTrans.localPosition = costPos_1; errorMsgTrans.gameObject.SetActive(false); actionMsgTrans.gameObject.SetActive(true); } else { errorMsg.text = "Не хватает монет"; costTrans.localPosition = costPos_2; actionMsgTrans.gameObject.SetActive(false); errorMsgTrans.gameObject.SetActive(true); minY += .5f; } } }
private void buyBuff (Buff buff) { Item targetItem = null; switch (buff.getBuffItemType()) { case BuffItemType.ARMOR: targetItem = armorHolder.getItem(); break; case BuffItemType.WEAPON: targetItem = weaponHolder.getItem(); break; case BuffItemType.SHIELD: targetItem = shieldHolder.getItem(); break; default: Debug.Log("Unknown Buff itemtype"); break; } if (Vars.gold >= buff.getCost() && !buff.isUsed() && targetItem != null) { targetItem.addToBuffs(buff); buff.setUsed(true); Vars.gold -= buff.getCost(); UserInterface.updateGold(); } }
public void showDescription(Buff buff) { this.buff = buff; BuffType buffType = buff.getBuffType(); nameValue.text = buffType.getName(); stat_2.text = ""; stat_1.text = buffType.getEffectName().Replace("?", buff.getEffectValue().ToString()); body.localPosition = bodyPosStat_1; description.transform.localPosition = descriptPos_1; quality.gameObject.SetActive(false); description.text = buff.getDescription(); costText.text = buff.getCost().ToString(); stretchBody(); setActionMsgForBuff(buff); onScreen = true; Update(); gameObject.SetActive(true); }