//internal void mobilize() //{ // foreach (var province in place.ownedProvinces) // { // Army newArmy = new Army(getCountry()); // foreach (var item in province.allPopUnits) // //if (item.popType.canMobilize() && item.howMuchCanMobilize(this) > 0) // newArmy.add(item.mobilize(this)); // } // consolidateArmies(); //} internal void mobilize(IEnumerable <Province> source) { foreach (var province in source) { Army newArmy = new Army(this); foreach (var pop in province.allPopUnits) { if (pop.popType.canMobilize(this) && pop.howMuchCanMobilize(this, null) > 0) { //newArmy.add(item.mobilize(this)); newArmy.add(Corps.mobilize(this, pop)); } } } consolidateArmies(); }
// private Army consolidatedArmy; public Army(Staff owner, Province where, string name) : base(name) { //if (!this.armies.Contains(this)) where.AddArmy(this); Province = where; owner.addArmy(this); this.owner = owner; World.DayPassed += OnMoveArmy; //Province.OwnerChanged += CheckPathOnProvinceOwnerChanged; personal = new Dictionary <PopUnit, Corps>(); foreach (var pop in where.AllPops) //mirrored in Staff. mobilization { if (pop.Type.canMobilize(owner) && pop.howMuchCanMobilize(owner, null) > 0) { //newArmy.add(item.mobilize(this)); this.add(Corps.mobilize(owner, pop)); } } var unitObject = Unit.Create(this); unit = unitObject.GetComponent <Unit>(); Game.provincesToRedrawArmies.Add(where); OnMoveArmy(this, EventArgs.Empty); foreach (var enemyArmy in Province.AllStandingArmies().Where(x => x.owner != owner).ToList()) { if (enemyArmy.getSize() > 0) { this.attack(enemyArmy).createMessage(); } } }