public void BuildAround(Vector2 centralNodePosition) { for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { if (x == 0 && y == 0) { continue; } Vector2 BuildPos = new Vector2(offset * x, offset * y) + centralNodePosition; Node node = this.Nodes.Find(n => n.Position == BuildPos); if (node == null)//New position, Build new node { Nodes.Add(generateMap.BuildNode(BuildPos)); } else//Node already exists, restore it { RestoreNode(node); } } } this.DestroyHiddenNodes(centralNodePosition); }
public Map(GenerateMap generateMap) { this.generateMap = generateMap; Nodes.Add(generateMap.BuildNode(Vector2.zero)); }