Class EntityTemplate

Namespace
TDMaker.Core.Defs
Assembly
TDMaker.Core.dll

An immutable template with nullable definition slots; null inherits its parent's slot.

public sealed class EntityTemplate
Inheritance
EntityTemplate
Inherited Members

Constructors

EntityTemplate(string, string, HealthDef, ArmorDef, MotionDef, PathFollowDef, BountyDef, MeleeDef, RangedDef, TowerDef, BarracksDef, SoldierDef, HeroDef, ProjectileDef, AuraDef, StatusImmunityDef, FlyingDef, RenderDef)

Creates template data; resolution happens when a registry is constructed.

public EntityTemplate(string id, string baseId = null, HealthDef health = null, ArmorDef armor = null, MotionDef motion = null, PathFollowDef pathFollow = null, BountyDef bounty = null, MeleeDef melee = null, RangedDef ranged = null, TowerDef tower = null, BarracksDef barracks = null, SoldierDef soldier = null, HeroDef hero = null, ProjectileDef projectile = null, AuraDef aura = null, StatusImmunityDef statusImmunity = null, FlyingDef flying = null, RenderDef render = null)

Parameters

id string
baseId string
health HealthDef
armor ArmorDef
motion MotionDef
pathFollow PathFollowDef
bounty BountyDef
melee MeleeDef
ranged RangedDef
tower TowerDef
barracks BarracksDef
soldier SoldierDef
hero HeroDef
projectile ProjectileDef
aura AuraDef
statusImmunity StatusImmunityDef
flying FlyingDef
render RenderDef

Properties

Armor

Defense definition.

public ArmorDef Armor { get; }

Property Value

ArmorDef

Aura

Optional region emitter definition.

public AuraDef Aura { get; }

Property Value

AuraDef

Barracks

Barracks definition.

public BarracksDef Barracks { get; }

Property Value

BarracksDef

BaseId

Optional parent identifier.

public string BaseId { get; }

Property Value

string

Bounty

Reward and exit cost definition.

public BountyDef Bounty { get; }

Property Value

BountyDef

CustomData

Immutable custom definition slots, inherited by type with child overrides.

public TemplateData CustomData { get; }

Property Value

TemplateData

Flying

Flying marker.

public FlyingDef Flying { get; }

Property Value

FlyingDef

Health

Health definition.

public HealthDef Health { get; }

Property Value

HealthDef

Hero

Independent hero behavior definition.

public HeroDef Hero { get; }

Property Value

HeroDef

Id

Unique template identifier.

public string Id { get; }

Property Value

string

Melee

Melee definition.

public MeleeDef Melee { get; }

Property Value

MeleeDef

Motion

Movement definition.

public MotionDef Motion { get; }

Property Value

MotionDef

PathFollow

Path traversal definition.

public PathFollowDef PathFollow { get; }

Property Value

PathFollowDef

Projectile

Projectile definition.

public ProjectileDef Projectile { get; }

Property Value

ProjectileDef

Ranged

Ranged attack definitions.

public RangedDef Ranged { get; }

Property Value

RangedDef

Render

View lookup definition.

public RenderDef Render { get; }

Property Value

RenderDef

Rules

Optional additional behavior slots, inherited as one immutable bundle.

public EntityRulesDef Rules { get; }

Property Value

EntityRulesDef

Soldier

Soldier definition.

public SoldierDef Soldier { get; }

Property Value

SoldierDef

StatusImmunity

Effect identity and family immunities.

public StatusImmunityDef StatusImmunity { get; }

Property Value

StatusImmunityDef

Tower

Tower economy definition.

public TowerDef Tower { get; }

Property Value

TowerDef

Methods

WithCustomData<T>(T)

Copies the template and adds or replaces one custom definition slot.

public EntityTemplate WithCustomData<T>(T value) where T : class

Parameters

value T

Returns

EntityTemplate

Type Parameters

T

Examples

var custom = template.WithCustomData(new ShieldDef(100));

WithRules(EntityRulesDef)

Creates a template copy with additional behavior data.

public EntityTemplate WithRules(EntityRulesDef rules)

Parameters

rules EntityRulesDef

Returns

EntityTemplate