Ejemplo n.º 1
0
        public virtual void SpreadPower(PowerNetwork pn)
        {
            this.grided = true;

            if (this.pn == null)
            {
                this.pn = pn;
            }

            if (Powered() && ProjectsPower())
            {
                HashSet <Hex> hexes = h.Neighbors().Aggregate(new HashSet <Hex>(),
                                                              (HashSet <Hex> acc, Hex hs) => {
                    acc.Add(h);
                    foreach (Hex n in hs.Neighbors())
                    {
                        acc.Add(n);
                    }
                    return(acc);
                });

                foreach (Hex hs in hexes)
                {
                    hs.pn = pn;
                }

                foreach (Hex hs in hexes)
                {
                    if (hs.building != null && !hs.building.grided)
                    {
                        if (VisuallyConnects() && hs.building.VisuallyConnects())
                        {
                            h.wm.bm.Add(h.loc, hs.loc);
                        }

                        hs.building.SpreadPower(pn);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void SpreadPower(PowerNetwork pn)
 {
     base.SpreadPower(pn);
     pn.warpgates++;
 }