Tower Dispose Method Delta Engine Documentation

Namespace: CreepyTowers.Towers
Assembly: CreepyTowers (in CreepyTowers.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public override void Dispose()

Implements

IDisposable Dispose 
Remarks

Tests: CreepyTowers.Tests.Towers.TowerTests
Examples

3 unit tests call CreepyTowers.Towers.Tower.Dispose
[Test]
public void DisplayAndDisposeTower()
{
    var tower = new Tower(TowerType.Water, Vector3D.Zero, 170.0f);
    tower.RenderModel();
    tower.Dispose();
    Assert.AreEqual(0, EntitiesRunner.Current.GetEntitiesOfType<Tower>().Count);
}
[Test, CloseAfterFirstFrame]
public void DisposingTowerRemovesTowerEntity()
{
    var tower = new Tower(TowerType.Water, Vector3D.Zero);
    tower.Dispose();
    Assert.IsFalse(tower.IsActive);
}
[Test]
public void ShowAllTowerTypesAndEffects()
{
    var tower = new Tower(TowerType.Acid, Vector3D.Zero);
    tower.RenderModel();
    var creep = new Creep(CreepType.Cloth, new Vector2D(2, 8));
    new Command(() => { tower.FireAtCreep(creep); }).Add(new KeyTrigger(Key.Space));
    new Command(() => { tower.RotationZ += 2; }).Add(new KeyTrigger(Key.A, State.Pressed));
    new Command(() => { tower.RotationZ -= 2; }).Add(new KeyTrigger(Key.D, State.Pressed));
    new Command(() =>
    { //ncrunch: no coverage start
        tower.Dispose();
        tower = new Tower(CycleTypeUpwards(tower.Type), Vector3D.Zero);
        tower.RenderModel(); //ncrunch: no coverage end
    }).Add(new KeyTrigger(Key.W));
    new Command(() =>
    { //ncrunch: no coverage start
        tower.Dispose();
        tower = new Tower(CycleTypeDownwards(tower.Type), Vector3D.Zero);
        tower.RenderModel(); //ncrunch: no coverage end
    }).Add(new KeyTrigger(Key.S));
}
See Also