/// <summary> /// (Cross-Game compatible) Has player already unlocked this TowerModel /// </summary> public static bool?IsTowerUnlocked(this TowerModel towerModel) { #if BloonsTD6 return(Game.instance?.GetBtd6Player()?.HasUnlockedTower(towerModel.GetBaseId())); #elif BloonsAT return(Game.instance.GetAdventureTimePlayer().HasUnlockedTower(towerModel.GetBaseId())); #endif }
/// <summary> /// Return the UpgradeModel for a specific upgrade path/tier /// </summary> /// <param name="path"></param> /// <param name="tier"></param> public static UpgradeModel GetUpgrade(this TowerModel towerModel, int path, int tier) { if (path < 0 || tier < 0) { return(null); } int tier1 = (path == 0) ? tier : 0; int tier2 = (path == 1) ? tier : 0; int tier3 = (path == 2) ? tier : 0; TowerModel tempTower = Game.instance?.model?.GetTower(towerModel.GetBaseId(), tier1, tier2, tier3); if (tempTower is null) { return(null); } const int offset = 1; List <UpgradeModel> appliedUpgrades = tempTower.GetAppliedUpgrades(); UpgradeModel results = appliedUpgrades.FirstOrDefault(model => model.path == path && model.tier == (tier - offset)); return(null); }
/// <summary> /// If this TowerModel is for a Hero, is this Hero unlocked? /// </summary> public static bool?IsHeroUnlocked(this TowerModel towerModel) { return(Game.instance?.GetBtd6Player()?.HasUnlockedHero(towerModel.GetBaseId())); }
/// <summary> /// Return the TowerPurchaseButton for this TowerModel. /// </summary> public static TowerPurchaseButton GetTowerPurchaseButton(this TowerModel towerModel) { return(ShopMenu.instance.GetTowerButtonFromBaseId(towerModel.GetBaseId())); }
/// <summary> /// Return all TowerDetailModels that share a base id with this towerModel /// </summary> public static TowerDetailsModel GetTowerDetailsModel(this TowerModel towerModel) { string baseId = towerModel.GetBaseId(); return(Game.instance?.model?.GetAllTowerDetails()?.FirstOrDefault(details => details.towerId == baseId)); }