Skip to Main Content
Table of Contents

BTD_Mod_Helper​.Extensions​.TowerModelExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

TowerModelExt Class

Extensions for TowerModels

public static class TowerModelExt

Inheritance System.Object  TowerModelExt

Methods

TowerModelExt.AddTiersToName(this TowerModel, int, int, int) Method

Format's the tower's name with its tiers

public static void AddTiersToName(this TowerModel towerModel, int tier1, int tier2, int tier3);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

tier1 System.Int32

tier2 System.Int32

tier3 System.Int32

TowerModelExt.AddTiersToName(this TowerModel) Method

Format's the tower's name with its tiers

public static void AddTiersToName(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

TowerModelExt.ApplyDisplay(this TowerModel) Method

Applies a given ModDisplay to this TowerModel

public static void ApplyDisplay<T>(this TowerModel towerModel)
    where T : BTD_Mod_Helper.Api.Display.ModDisplay;

Type parameters

T

The type of ModDisplay

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

TowerModelExt.GetAbilities(this TowerModel) Method

Return all AbilityModel behaviors from this tower, if it has any

public static System.Collections.Generic.List<AbilityModel> GetAbilities(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Collections.Generic.List<Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities.AbilityModel>

TowerModelExt.GetAbility(this TowerModel, int) Method

Return a specific Ability of the tower.

public static AbilityModel GetAbility(this TowerModel towerModel, int index);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

the TowerModel

index System.Int32

Index of the ability you want.

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities.AbilityModel

TowerModelExt.GetAbility(this TowerModel) Method

Return the first ability on the tower

public static AbilityModel GetAbility(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities.AbilityModel

TowerModelExt.GetAllTowerToSim(this TowerModel) Method

Return all TowerToSimulations with this TowerModel

public static System.Collections.Generic.List<TowerToSimulation> GetAllTowerToSim(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Collections.Generic.List<Il2CppAssets.Scripts.Unity.Bridge.TowerToSimulation>

TowerModelExt.GetAppliedUpgrades(this TowerModel) Method

Return all UpgradeModels that are currently applied to this TowerModel

public static System.Collections.Generic.List<UpgradeModel> GetAppliedUpgrades(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Collections.Generic.List<Il2CppAssets.Scripts.Models.Towers.Upgrades.UpgradeModel>

TowerModelExt.GetAttackModel(this TowerModel, int) Method

Return one of the AttackModels from this TowerModel. By default will give the first AttackModel

public static AttackModel GetAttackModel(this TowerModel towerModel, int index);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

The TowerModel

index System.Int32

Index of the AttackModel you want

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.AttackModel

TowerModelExt.GetAttackModel(this TowerModel, string) Method

Return the first AttackModel whose name contains the given string

public static AttackModel GetAttackModel(this TowerModel towerModel, string nameContains);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

nameContains System.String

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.AttackModel

TowerModelExt.GetAttackModel(this TowerModel) Method

Return the first AttackModel from this TowerModel, if it has one

public static AttackModel GetAttackModel(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.AttackModel

TowerModelExt.GetAttackModels(this TowerModel) Method

Return all AttackModel behaviors for this TowerModel

public static System.Collections.Generic.List<AttackModel> GetAttackModels(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Collections.Generic.List<Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.AttackModel>

TowerModelExt.GetBaseId(this TowerModel) Method

Get the name of the BaseTower. Will be different from this TowerModel's name if this TowerModel isn't a BaseTower

public static string GetBaseId(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.String

TowerModelExt.GetHeroModel(this TowerModel) Method

If this TowerModel is a Hero, return the HeroModel behavior

public static HeroModel GetHeroModel(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Models.Towers.Behaviors.HeroModel

TowerModelExt.GetIndex(this TowerModel) Method

Return the number position of this TowerModel in the list of all tower models

public static int GetIndex(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Int32

TowerModelExt.GetModTower(this TowerModel) Method

Gets the ModTower associated with this TowerModel


If there is no associated ModTower, returns null

public static BTD_Mod_Helper.Api.Towers.ModTower GetModTower(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

ModTower

TowerModelExt.GetModTower(this TowerModel) Method

Gets the specific ModTower associated with this TowerModel


If there is no associated ModTower, returns null

public static T GetModTower<T>(this TowerModel towerModel)
    where T : BTD_Mod_Helper.Api.Towers.ModTower;

Type parameters

T

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

T

TowerModelExt.GetTowerDetailsModel(this TowerModel) Method

Return all TowerDetailModels that share a base id with this towerModel

public static TowerDetailsModel GetTowerDetailsModel(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Models.TowerSets.TowerDetailsModel

TowerModelExt.GetTowerId(this TowerModel) Method

Get the TowerId of this TowerModel. Equivalent to towerModel.name

public static string GetTowerId(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.String

TowerModelExt.GetTowerPurchaseButton(this TowerModel) Method

Return the TowerPurchaseButton for this TowerModel.

public static TowerPurchaseButton GetTowerPurchaseButton(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Unity.UI_New.InGame.StoreMenu.TowerPurchaseButton

TowerModelExt.GetTowerSet(this TowerModel) Method

Gets the tower set (vanilla or modded) of this tower in the form of a string

public static string GetTowerSet(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.String

TowerModelExt.GetUpgrade(this TowerModel, int, int) Method

Return the UpgradeModel for a specific upgrade path/tier

public static UpgradeModel GetUpgrade(this TowerModel towerModel, int path, int tier);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

path System.Int32

tier System.Int32

Returns

Il2CppAssets.Scripts.Models.Towers.Upgrades.UpgradeModel

TowerModelExt.GetUpgradeLevel(this TowerModel, int) Method

Return the current upgrade level of a specific path

public static int GetUpgradeLevel(this TowerModel towerModel, int path);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

the TowerModel

path System.Int32

What tier of upgrade is currently applied to tower

Returns

System.Int32

TowerModelExt.GetWeapon(this TowerModel, int) Method

Return one of the WeaponModels this TowerModel has. By default will return the first one

public static WeaponModel GetWeapon(this TowerModel towerModel, int index);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

The TowerModel

index System.Int32

Index of WeaponModel that you want

Returns

Il2CppAssets.Scripts.Models.Towers.Weapons.WeaponModel

TowerModelExt.GetWeapon(this TowerModel) Method

Return the first WeaponModel this TowerModel has, if it has one.

public static WeaponModel GetWeapon(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

Il2CppAssets.Scripts.Models.Towers.Weapons.WeaponModel

TowerModelExt.GetWeapons(this TowerModel) Method

Recursively get every WeaponModels this TowerModel has

public static System.Collections.Generic.List<WeaponModel> GetWeapons(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Collections.Generic.List<Il2CppAssets.Scripts.Models.Towers.Weapons.WeaponModel>

TowerModelExt.HasTiers(this TowerModel, int, int, int) Method

Check if this tower has speficif upgrade tiers

public static bool HasTiers(this TowerModel towerModel, int tier1=0, int tier2=0, int tier3=0);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

tier1 System.Int32

tier2 System.Int32

tier3 System.Int32

Returns

System.Boolean

TowerModelExt.HasUpgrade(this TowerModel, int, int) Method

Check if an upgrade has been applied

public static bool HasUpgrade(this TowerModel towerModel, int path, int tier);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

path System.Int32

tier System.Int32

Returns

System.Boolean

TowerModelExt.HasUpgrade(this TowerModel, UpgradeModel) Method

Check if an upgrade has been applied

public static bool HasUpgrade(this TowerModel towerModel, UpgradeModel upgradeModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

upgradeModel Il2CppAssets.Scripts.Models.Towers.Upgrades.UpgradeModel

Returns

System.Boolean

TowerModelExt.IncreaseRange(this TowerModel, float) Method

Increase the range of a tower and all its attacks by the given amount

public static void IncreaseRange(this TowerModel towerModel, float rangeIncrease);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

rangeIncrease System.Single

TowerModelExt.IsHeroUnlocked(this TowerModel) Method

If this TowerModel is for a Hero, is this Hero unlocked?

public static System.Nullable<bool> IsHeroUnlocked(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Nullable<System.Boolean>

TowerModelExt.IsTowerUnlocked(this TowerModel) Method

Has player already unlocked this TowerModel

public static System.Nullable<bool> IsTowerUnlocked(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Nullable<System.Boolean>

TowerModelExt.IsUpgradePathUsed(this TowerModel, int) Method

Check if a specific upgrade path is being used/ has any upgrades applied to it

public static bool IsUpgradePathUsed(this TowerModel towerModel, int path);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

the TowerModel

path System.Int32

Upgrade path to check

Returns

System.Boolean

TowerModelExt.IsUpgradeUnlocked(this TowerModel, int, int) Method

Has a specific upgrade for this TowerModel been unlocked already?

public static System.Nullable<bool> IsUpgradeUnlocked(this TowerModel towerModel, int path, int tier);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

the TowerModel

path System.Int32

Upgrade path

tier System.Int32

Tier of upgrade

Returns

System.Nullable<System.Boolean>

TowerModelExt.IsVanillaTower(this TowerModel) Method

Gets whether a Tower/Hero is a base one added by the vanilla game.

public static bool IsVanillaTower(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

Returns

System.Boolean

TowerModelExt.MakeCopy(this TowerModel, string, bool, string) Method

Duplicate this TowerModel with a unique name. Very useful for making custom TowerModels

public static TowerModel MakeCopy(this TowerModel towerModel, string newTowerId, bool addToGame=false, string newBaseId=null);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

newTowerId System.String

Set's the new towerId of this copy. By default the baseId will be set to this as well

addToGame System.Boolean

newBaseId System.String

Specify a new baseId. Set this if you want a baseId other than the newTowerId

Returns

Il2CppAssets.Scripts.Models.Towers.TowerModel

TowerModelExt.SellAll(this TowerModel) Method

Sell every tower that uses this TowerModel

public static void SellAll(this TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

TowerModelExt.SetMaxAmount(this TowerModel, int) Method

Not Tested. Use to set the maximum allowed number of this tower

public static void SetMaxAmount(this TowerModel towerModel, int max);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

max System.Int32

TowerModelExt.SetTiers(this TowerModel, int, int, int, bool) Method

Sets a TowerModel's tiers

public static void SetTiers(this TowerModel towerModel, int tier1=0, int tier2=0, int tier3=0, bool addToTowerName=false);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

tier1 System.Int32

tier2 System.Int32

tier3 System.Int32

addToTowerName System.Boolean

To learn how to download BTD Mod Helper and install mods, click here