public void upgradeWorker(WorkerBuildingCard card) { RawImage worker = this.workers.Dequeue(); this.updateWorkerNum(-1); card.workers.Enqueue(worker); card.updateWorkerNum(1); U.cpUI.statisticUI.reduce(card.buildCost); U.cpUI.statisticUI.add(buildCost); U.cpUI.statisticUI.computeMilitaryStatistic(); U.ui.closeAllView(); U.cpUI.actionUI.updateInteriorRemainder(-1); }
void leaderHandle() { leaderRountNum++; WorkerBuildingCard card = (WorkerBuildingCard)U.cpUI.getBuildingCards(CardType.MILITARY_BUILDING).Find(c => c.id == CardId.WARRIOR); if (card == null) { return; } if (U.currentLeader == CardId.LEADER_MZD && leaderRountNum % 2 == 1) { card.buildCost = new Statistic(); } else { card.buildCost = card.buildCostBackup; } }
public void computeMilitaryStatistic() { List <BuildingCard> cards = U.cpUI.getBuildingCards(CardType.MILITARY_BUILDING); foreach (var card in cards) { WorkerBuildingCard c = (WorkerBuildingCard)card; attack = c.workers.Count * c.buildIncome.attack; defense = c.workers.Count * c.buildIncome.defense; if (U.currentLeader == CardId.LEADER_MZD) { if (c.id == CardId.WARRIOR) { defense += c.workers.Count / 2; } } } refresh(); }