コード例 #1
0
 public void Undo()
 {
     foreach (var connection in _currentConnections)
     {
         _layout.AddNodeConnections(connection);
     }
 }
コード例 #2
0
        public void SavesNodeConnectionToLayout()
        {
            var layoutToSave   = new PuzzleLayout();
            var nodeConnection = new NodeConnection(new TilePos(0, 0), new TilePos(1, 1));

            layoutToSave.AddNodeConnections(nodeConnection);

            var savedLayout = _sut.SaveToFlatLayout(layoutToSave);

            savedLayout.Connections[0].Should().Be(nodeConnection);
        }
コード例 #3
0
        public void Undo()
        {
            foreach (var removedConnection in _removedConnections)
            {
                _layout.AddNodeConnections(removedConnection);
            }

            foreach (var removedObject in _removedObjects)
            {
                _layout.PlaceObject(removedObject.Type, removedObject.Position);
            }
        }
コード例 #4
0
        public void DoesNotCreateOverlappingTiles()
        {
            var layout = new PuzzleLayout();

            layout.AddNodeConnections(new NodeConnection(new TilePos(0, 0), new TilePos(1, 0)));
            layout.PlaceObject("Trap", new TilePos(0, 0));

            var pool = new TestGamePool();

            new Systems()
            .Add(pool.CreateSystem <PositionsCacheUpdateSystem>())
            .Add(pool.CreateSystem(new GameLevelLoaderSystem(layout)))
            .Initialize();

            var tilesAtPosition = pool.GetEntitiesAt(new TilePos(0, 0), e => e.IsTile());

            tilesAtPosition.Count.Should().Be(1);
        }
コード例 #5
0
 public void Execute()
 {
     _layout.AddNodeConnections(_connection);
 }
コード例 #6
0
 private void LayoutConnectionBetween(TilePos position1, TilePos position2)
 {
     _layout.AddNodeConnections(new NodeConnection(position1, position2));
 }