Grid IsValidPosition Method Delta Engine Documentation

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

public bool IsValidPosition(
	Block block
)

Return Value

Type: Boolean
Remarks

Tests: Blocks.Tests.GridTests
Examples

2 unit tests call Blocks.Grid.IsValidPosition(Blocks.Block)
[Test, Ignore]
public void IsValidPositionInEmptyGrid()
{
    Assert.IsFalse(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(-1, 1))));
    Assert.IsFalse(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(9, 1))));
    Assert.IsFalse(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(0, 0))));
    //using (NUnit.Framework.Randomizer.Use(new FixedRandom(IBlock)))
        Assert.IsFalse(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(0, 17))));

    Assert.IsTrue(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(2, 2))));
}
[Test, Ignore]
public void IsValidPositionInOccupiedGrid()
{
    grid.AffixBlock(new Block(displayMode, content, new Vector2D(5, 1)));
    Assert.IsFalse(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(3, 0))));
    Assert.IsTrue(grid.IsValidPosition(new Block(displayMode, content, new Vector2D(5, 2))));
}
See Also