internal APISector(IVirtualWorld world, string name, params ITower[] towers) { Name = name; Towers = new List <ITower>(); Towers.AddRange(towers); World = world; World.Sectors.Add(this); }
public Sector(IVirtualWorld world, string name, int towers) : base(world, name) { /*if (!world.Sectors.Contains(this)) * { * world.Sectors.Add(this); * } */ for (int i = 1; i < towers + 1; i++) { Towers.Add(new Tower(i, this)); } }
public Sector(IVirtualWorld virtualworld, string sectorName, int towers = 0) : base(virtualworld, sectorName) { //we want to add our own Tower implementation to the list, not APITower (which is what happens if you add the tower variable to the base() ) if (towers < 1) { return; } Towers.Add(new Tower(this, 1, true)); //create a waytower for (int i = 2; i < towers; i++) { Towers.Add(new Tower(this, i)); //not a waytower } Towers.Add(new Tower(this, towers, true)); //waytower on the last number }
public APISector(IVirtualWorld virtualworld, string sectorName, int towers = 0) { Name = sectorName; Towers = new List <ITower>(); for (int i = 1; i <= towers; i++) { Towers.Add(new APITower(this, i)); } World = virtualworld; if (!World.Sectors.Contains(this)) { World.Sectors.Add(this); } }