Controller FallingBlock Property Delta Engine Documentation

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

public Block FallingBlock { get; }

Property Value

Type: Block
Remarks

Tests: Blocks.Tests.ControllerTests
Examples

8 unit tests call Blocks.Controller.FallingBlock
[Test, CloseAfterFirstFrame]
public void RunCreatesFallingAndUpcomingBlocks()
{
    AdvanceTimeAndUpdateEntities(0.1f);
    Assert.IsNotNull(controller.FallingBlock);
    Assert.IsNotNull(controller.UpcomingBlock);
}
[Test, CloseAfterFirstFrame]
public void WhenABlockAffixesTheUpcomingBlockBecomesTheFallingBlock()
{
    AdvanceTimeAndUpdateEntities(1.0f);
    var upcomingBlock = controller.UpcomingBlock;
    AdvanceTimeAndUpdateEntities(10.0f);
    Assert.AreEqual(upcomingBlock, controller.FallingBlock);
}
[Test, CloseAfterFirstFrame]
public void CantMoveLeftAtLeftWall()
{
    Assert.IsFalse(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
    controller.FallingBlock = new Block(displayMode, content, new Vector2D(0, 1));
    controller.MoveBlockLeftIfPossible();
    Assert.IsTrue(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
    Assert.AreEqual(0, controller.FallingBlock.Left);
}
See Also