Ejemplo n.º 1
0
 private void SetupTileBrushAction()
 {
     foreach (var e in _context.GetEntities(TileMatcher.Tile))
     {
         e.AddTileAction(() => BrushAction(e));
     }
 }
Ejemplo n.º 2
0
 public void Initialize()
 {
     foreach (var e in _context.GetEntities(TileMatcher.Tile))
     {
         e.AddTileHoverAction(() => _toolKit.ShowTileDetail(e));
     }
 }
Ejemplo n.º 3
0
    public void Initialize()
    {
        var tiles = _context.GetEntities(TileMatcher.Tile);

        foreach (var originTile in tiles)
        {
            originTile.AddTileGraph(null, null, null, null);
            foreach (var tile in tiles.Where(t => t.mapPosition.GetDistance(originTile.mapPosition) == 1))
            {
                if (tile.mapPosition.y < originTile.mapPosition.y)
                {
                    originTile.tileGraph.Down = tile;
                }
                else if (tile.mapPosition.y > originTile.mapPosition.y)
                {
                    originTile.tileGraph.Up = tile;
                }
                else if (tile.mapPosition.x > originTile.mapPosition.x)
                {
                    originTile.tileGraph.Right = tile;
                }
                else
                {
                    originTile.tileGraph.Left = tile;
                }
            }
        }
    }
    public void Initialize()
    {
        var spawnpoints = _tileContext.GetEntities(TileMatcher.Spawnpoint);
        var players     = _gameContext.GetEntities(GameMatcher.Player);

        Assert.IsTrue(spawnpoints.Length >= players.Length);

        int i = 0;

        foreach (var playerEntity in players.OrderBy(p => p.player.PlayerId))
        {
            var sp = spawnpoints[i];

            var characterType = (Character)playerEntity.player.GetNetworkPlayer().SelectedCharacterId;
            Assert.IsTrue(characterType != Character.None);

            var character = _unitContext.CreateEntity();
            character.AddOwner(playerEntity);
            character.AddCharacter(characterType);
            character.AddMapPosition(sp.mapPosition.x, sp.mapPosition.y);
            i++;
        }
    }