コード例 #1
0
ファイル: GridSimulator.cs プロジェクト: Mojopon/ThreeSeven
    public void CreateSimulatedGridOriginal()
    {
        _simulatedGridOriginal = new SimulatedBlock[_setting.GridWidth, _setting.GridHeight];

        for (int y = 0; y < _setting.GridHeight; y++)
        {
            for (int x = 0; x < _setting.GridWidth; x++)
            {
                if (_grid[x, y] != null)
                {
                    _simulatedGridOriginal[x, y] = new SimulatedBlock(_grid[x, y]);
                }
            }
        }

        _simulatedGrid = new SimulatedBlock[_setting.GridWidth, _setting.GridHeight];

        CopyOriginalToSimulatedGrid();

        if (_grid.CurrentGroup == null)
        {
            return;
        }
        _simulatedGroup = new SimulatedGroup();
        _simulatedGroup.Simulate(_grid.CurrentGroup);
    }
コード例 #2
0
 public void LocationShouldBeAffectedByLocationInTheGroup()
 {
     var block = new SimulatedBlock();
     block.LocationInTheGroup = new Coord(0, 2);
     block.SetLocation(new Coord(1, 2));
     Assert.AreEqual(new Coord(1, 4), block.Location);
 }
コード例 #3
0
    public void CreateSimulatedGridOriginal()
    {
        _simulatedGridOriginal = new SimulatedBlock[_setting.GridWidth, _setting.GridHeight];

        for (int y = 0; y < _setting.GridHeight; y++)
        {
            for (int x = 0; x < _setting.GridWidth; x++)
            {
                if (_grid[x, y] != null)
                {
                    _simulatedGridOriginal[x, y] = new SimulatedBlock(_grid[x, y]);
                }
            }
        }

        _simulatedGrid = new SimulatedBlock[_setting.GridWidth, _setting.GridHeight];

        CopyOriginalToSimulatedGrid();

        if (_grid.CurrentGroup == null)
        {
            return;
        }
        _simulatedGroup = new SimulatedGroup();
        _simulatedGroup.Simulate(_grid.CurrentGroup);
    }
コード例 #4
0
 public void ShouldIgnoreLocationInTheGroupWhenFixedOnGridIsTrue()
 {
     var block = new SimulatedBlock();
     block.LocationInTheGroup = new Coord(0, 2);
     block.FixedOnGrid = true;
     block.SetLocation(new Coord(1, 2));
     Assert.AreEqual(new Coord(1, 2), block.Location);
 }
コード例 #5
0
    public void LocationShouldBeAffectedByLocationInTheGroup()
    {
        var block = new SimulatedBlock();

        block.LocationInTheGroup = new Coord(0, 2);
        block.SetLocation(new Coord(1, 2));
        Assert.AreEqual(new Coord(1, 4), block.Location);
    }
コード例 #6
0
    public void ShouldIgnoreLocationInTheGroupWhenFixedOnGridIsTrue()
    {
        var block = new SimulatedBlock();

        block.LocationInTheGroup = new Coord(0, 2);
        block.FixedOnGrid        = true;
        block.SetLocation(new Coord(1, 2));
        Assert.AreEqual(new Coord(1, 2), block.Location);
    }