Beispiel #1
0
        public void DrawBorder(IHexMap map)
        {
            // Get first tile with any neighbour of another province
            var tiles           = Provinces.SelectMany(p => p.HexTiles).ToList();
            var firstBorderTile = tiles.Where(t => map.GetNeighbours(t).Where(n => n.Province == null || (Country)n.Province.Owner != this).Any()).First();
            var neighbourPairs  = map.GetNeighboursWithDirection(firstBorderTile).ToList();
            var neighbourPair   = neighbourPairs.Where(n => n.Neighbour.Province == null || (Country)n.Neighbour.Province.Owner != this).First();
            var borderRoute     = new List <TilePair>();

            TraceBorder(neighbourPair, borderRoute, map);
            var vectors = borderRoute.SelectMany(p => p.HexTile.GetVertices(p.Direction)).Distinct().ToArray();

            var lineRenderer = GetComponent <LineRenderer>();

            lineRenderer.positionCount = vectors.Length;
            //lineRenderer.SetVertexCount(vectors.Length);
            lineRenderer.SetPositions(vectors);
        }