Plane Hitpoints Property Delta Engine Documentation

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

public int Hitpoints { get; protected set; }

Property Value

Type: Int32
Remarks

Tests: SideScroller.Tests.EnemyPlaneTests
Examples

2 unit tests call SideScroller.Plane.Hitpoints
[Test]
public void LowerLifeWhenHitByBullet()
{
    enemy = new EnemyPlane(new Vector2D(1.2f, 0.5f));
    Assert.AreEqual(5, enemy.Hitpoints);
    enemy.CheckIfHitAndReact(new Vector2D(1.2f, 0.5f));
    Assert.AreEqual(4, enemy.Hitpoints);
}
[Test]
public void DefeatEnemyPlane()
{
    enemy = new EnemyPlane(new Vector2D(1.2f, 0.9f));
    bool defeated = false;
    enemy.Destroyed += () => { defeated = true; };
    enemy.ReceiveAttack(5);
    Assert.LessOrEqual(enemy.Hitpoints, 0);
    Assert.IsTrue(defeated);
}
See Also