private void GenerateMapSprites() { for (int i = 0; i < HexMap.Hexes.Count; i++) { for (int j = 0; j < HexMap.Hexes[i].Count; j++) { var newHex = HexComponent.Instance() as HexComponent; newHex.Hex = HexMap.Hexes[i][j]; var sprite = newHex.GetNode <Sprite>(newHex.SpritePath); sprite.Modulate = GetHexColour(newHex.Hex.Terrain); //change hex position var spriteSize = sprite.Texture.GetSize(); var pos = spriteSize * new Vector2(i, j); pos.y *= 0.75f; if ((j % 2) == 1) { pos.x += (spriteSize.x) / 2f; } newHex.Position = pos + (spriteSize / 2f); newHex.Name = $"Hex({i},{j})"; //newHex.SetNameOfFeature(newHex.Name); //newHex.EnableNeighbourIndicators(); HexComponentDict.Add(newHex.Hex, newHex); MapNode.AddChild(newHex, true); } } }
List <List <MapNode> > GenerateBossLayers(int depth) { List <List <MapNode> > layers = new List <List <MapNode> >(); MapNode starterNode = new MapNode(MapNodeType.Start, 0); // Every map starts with a layer of one (starter) node. layers.Add(new List <MapNode>() { starterNode }); MapNode bossNode = new MapNode(MapNodeType.Boss, 1); layers.Add(new List <MapNode>() { bossNode }); starterNode.AddChild(bossNode); return(layers); }