Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 2
0
	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;
			}
		}
	}