예제 #1
0
        /// <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
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 /// <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()));
 }
예제 #4
0
 /// <summary>
 /// Return the TowerPurchaseButton for this TowerModel.
 /// </summary>
 public static TowerPurchaseButton GetTowerPurchaseButton(this TowerModel towerModel)
 {
     return(ShopMenu.instance.GetTowerButtonFromBaseId(towerModel.GetBaseId()));
 }
예제 #5
0
        /// <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));
        }