Skip to Main Content

BTD_Mod_Helper​.Extensions​.ModelExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

ModelExt Class

Extensions for Models

public static class ModelExt

Inheritance System.Object  ModelExt

Methods

ModelExt.AddChildDependants(this Model, IEnumerable) Method

Add multiple Child Dependants at the same time. Equivalent to calling the (weirdly non plural named) Model.AddChild
method but without having to do an ICollection cast

public static void AddChildDependants<T>(this Model model, System.Collections.Generic.IEnumerable<T> children)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

children System.Collections.Generic.IEnumerable<T>

ModelExt.Duplicate(this T, string) Method

Duplicates a model and also sets its name to something new

public static T Duplicate<T>(this T model, string name)
    where T : Model;

Type parameters

T

Type of object you want to cast to when duplicating. Done automatically

Parameters

model T

name System.String

Returns

T

ModelExt.Duplicate(this T) Method

Create a new and separate copy of this object. Same as using: .Clone().Cast();

public static T Duplicate<T>(this T model)
    where T : Model;

Type parameters

T

Type of object you want to cast to when duplicating. Done automatically

Parameters

model T

Returns

T

ModelExt.FindDescendant(this Model, string) Method

Finds the first descendent of a given type whose name contains the specified string, or null if not found

public static T FindDescendant<T>(this Model model, string nameContains)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

nameContains System.String

Returns

T

ModelExt.FindDescendant(this Model, Predicate) Method

Finds the first descendent of a given type that matches the given condition, or null if not found

public static T FindDescendant<T>(this Model model, System.Predicate<T> condition)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

condition System.Predicate<T>

Returns

T

ModelExt.FindDescendants(this Model, string) Method

Finds the descendents of a given type whose name contains the specified string

public static T[] FindDescendants<T>(this Model model, string nameContains)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

nameContains System.String

Returns

T[]

ModelExt.FindDescendants(this Model, Predicate) Method

Finds the descendents of a given type that matches the given condition

public static T[] FindDescendants<T>(this Model model, System.Predicate<T> condition)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

condition System.Predicate<T>

Returns

T[]

ModelExt.FindDescendants(this Model) Method

Finds the descendents of a given type

public static T[] FindDescendants<T>(this Model model)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

Returns

T[]

ModelExt.HasDescendant(this Model, string, T) Method

Returns whether a model has a descendant of a given type with a filtered name, providing it via the out parameter if so

public static bool HasDescendant<T>(this Model model, string nameContains, out T t)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

nameContains System.String

t T

Returns

System.Boolean

ModelExt.HasDescendant(this Model, T) Method

Returns whether a model has a descendant of a given type, providing it via the out parameter if so

public static bool HasDescendant<T>(this Model model, out T t)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

t T

Returns

System.Boolean

ModelExt.HasDescendant(this Model) Method

Returns whether a model has a descendant of a given type

public static bool HasDescendant<T>(this Model model)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

Returns

System.Boolean

ModelExt.RemoveChildDependants(this Model, IEnumerable) Method

Remove multiple Child Dependants at the same time. Equivalent to calling the (weirdly non plural named) Model.RemoveChild
method but without having to do an ICollection cast

public static void RemoveChildDependants<T>(this Model model, System.Collections.Generic.IEnumerable<T> children)
    where T : Model;

Type parameters

T

Parameters

model Il2CppAssets.Scripts.Models.Model

children System.Collections.Generic.IEnumerable<T>

ModelExt.SetName(this T, string) Method

Sets the name of this model, properly appending the type prefix to it.


Also sets the id if it's a ProjectileModel
The model itself

public static T SetName<T>(this T model, string name)
    where T : Model;

Type parameters

T

Parameters

model T

name System.String

Returns

T

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