public GetPath ( Vector2 start, Vector2 end ) : |
||
start | Vector2 | The start tile coordinate. |
end | Vector2 | The end tile coordinate. |
return |
public void VolunteerCitizen(MSMap map) { MS3DTile bldg = map.GetRandomCitizenSource(); MS3DTile center = map.GetNearestVolunteerCenter(bldg); Node path = map.GetPath(bldg.TileCoordinate, center.TileCoordinate); MSVolunteeringCitizen v = new MSVolunteeringCitizen(bldg.Position + MSUnit.UNITZ_POSITION, path, map, 0); units.Add(v); }
public void SendWorkers(MSMap map, MSChangeableBuilding bldg, int qty) { MSVolunteerCenter center = map.GetNearestVolunteerCenter(bldg); Node path = map.GetPath(center.TileCoordinate, bldg.TileCoordinate); for (int i = 0; i < qty; i++) { MSWorker worker = new MSWorker(center.Position + MSUnit.UNITZ_POSITION, path, bldg, map, 0); units.Add(worker); } }
public void TryForBaby(MSMap map) { List<MSUnit> mobbers = new List<MSUnit>(); for (int i = 0; i < 9; i++) { MSMobParam mp = this.mobTypeParam[i]; int rnd = MSRandom.Instance.GetUniformInt(100); if (rnd < mp.getProbability()) { System.Console.WriteLine("SUCCESS"); MSUnit person; MSUnchangeableBuilding source = map.GetRandomCitizenSource(); MSUnchangeableBuilding sink; do { sink = map.GetRandomCitizenSource(); } while (source == sink); Vector2 start = new Vector2(source.Row, source.Column); Vector2 end = new Vector2(sink.Row, sink.Column); MSMilleniumDevelopmentGoal? mdg = this.getGoal(i); if (mdg != null) { MSMilleniumDevelopmentGoal mobmdg = (MSMilleniumDevelopmentGoal)mdg; person = new MSMobber( map.MapArray[(int)start.X, (int)start.Y].Position + MSUnit.UNITZ_POSITION, map.GetPath(start, MSDistrictHall.getInstance().TileCoordinate), map, mobmdg, 0); } else { Node path = map.GetPath(start, end); person = new MSCitizen( map.MapArray[(int)start.X, (int)start.Y].Position + MSUnit.UNITZ_POSITION, path, map, true, 0); } if (person != null) { if (mdg != null) units.Add(person); else mobbers.Add(person); } } } if( mobbers.Count > 0 ) units.Add(mobbers.ElementAt<MSUnit>(MSRandom.Instance.GetUniformInt(mobbers.Count))); }
public void SendVolunteer(MSMap map, MSUnit unit, MSTower office) { Node path1 = map.GetPath(new Vector2(office.Row, office.Column), unit.TileCoordinate); Node pathEnd = path1; while (pathEnd.next != null) { pathEnd = pathEnd.next; } pathEnd.next = unit.Path; MSVolunteer volunteer = new MSVolunteer ( office.Position + MSUnit.UNITZ_POSITION, path1, unit, office, map, 0 ); MSUnitHandler.GetInstance().AddUnit(volunteer); }