// ******************************************************************* // Portal // ******************************************************************* public Portal(Border b) { // get the maptile of this border tile1 = b.Tile; // assign tiles // get any neighbor whose cost is 1 tile2 = b.Neighbors() .Where(n => b.Cost(n) == 1) .Cast <Border>() .FirstOrDefault()?.Tile; if (tile2 == null) { UnityEngine.Debug.LogError("Portal has no neighboring border"); } Center = b.Center; Width = b.GetLocations().Count(); costByNode = new Dictionary <IPathable, float>(); }