public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); foreach (var buildingId in BuildingIds) { ConstructionItem gameObjectById = (ConstructionItem)level.GameObjectManager.GetGameObjectByID(buildingId); int diamondCount = ((BuildingData)gameObjectById.GetConstructionItemData()).BoostCost[gameObjectById.UpgradeLevel]; if (avatar.HasEnoughDiamonds(diamondCount)) { gameObjectById.BoostBuilding(); avatar.SetDiamonds(avatar.GetDiamonds() - diamondCount); } } }
public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); foreach (int buildingId in BuildingIds) { GameObject go = level.GameObjectManager.GetGameObjectByID(buildingId); ConstructionItem b = (ConstructionItem)go; int costs = ((BuildingData)b.GetConstructionItemData()).BoostCost[b.UpgradeLevel]; if (ca.HasEnoughDiamonds(costs)) { b.BoostBuilding(); ca.SetDiamonds(ca.GetDiamonds() - costs); } } }
internal override void Process() { ClientAvatar ca = this.Device.Player.Avatar; foreach (int buildingId in BuildingIds) { GameObject go = this.Device.Player.GameObjectManager.GetGameObjectByID(buildingId); ConstructionItem b = (ConstructionItem)go; int costs = ((BuildingData)b.GetConstructionItemData()).BoostCost[b.UpgradeLevel]; if (ca.HasEnoughDiamonds(costs)) { b.BoostBuilding(); ca.m_vCurrentGems = ca.m_vCurrentGems - costs; } } }