private static Traveler SetupWorld() { var world = ExampleWorld.Sample(); const string start = "A"; var walker = new Walker(Vector3.Zero); var traveler = new Traveler(start, world, walker); return(traveler); }
private static Traveler SetupTraveler(string start) { var world = ExampleWorld.Sample(); var walker = new Walker(Vector3.Zero); var traveler = new Traveler(start, world, walker); var zoner = new Zoner(traveler, world); return(traveler); }
public void GetZoneBorderFromPointCanGetBorder() { const string targetZoneName = "B"; var want = ExampleWorld.ZoneA().Boundaries.Find(b => b.ToZone == targetZoneName); var fromPosition = want.FromPosition; var targetPosition = want.ToPosition; var traveler = new Traveler { CurrentZone = ExampleWorld.ZoneA(), Position = Vector3.Zero, World = ExampleWorld.Sample() }; var got = traveler.GetZoneBorderToNameFromPoint(fromPosition); Assert.Equal(want, got); }
public void WalkThroughZonesTravelsThroughZones() { const string start = "A"; const string end = "D"; // setup the world var world = ExampleWorld.Sample(); var walker = new Walker(Vector3.Zero); var traveler = new Traveler(start, world, walker); var zoner = new Zoner(traveler, world); var zones = new List <Zone> { world.GetZoneByName("A"), world.GetZoneByName("C"), world.GetZoneByName("D") }; traveler.WalkToZone(end, true); Assert.Equal(end, traveler.CurrentZone.Name); }
public void GoToZoneWillActuallyZoneTheTraveler() { const string targetZoneName = "B"; var targetPosition = ExampleWorld.ZoneA().Boundaries.Find(b => b.ToZone == targetZoneName).ToPosition; var traveler = new Traveler { CurrentZone = ExampleWorld.ZoneA(), Position = Vector3.Zero, World = ExampleWorld.Sample() }; traveler.PathMaker = new GridPathMaker { ZoneMap = traveler.CurrentZone.Map }; var zoner = new Zoner(traveler, ExampleWorld.Sample()); traveler.WalkToZone(targetZoneName); Assert.Equal(targetZoneName, traveler.CurrentZone.Name); Assert.Equal(targetPosition, traveler.Walker.CurrentPosition); }
public void CanPathFromWorldList() { var start = "A"; var end = "D"; var world = ExampleWorld.Sample(); var traveler = new Traveler(); var got = WorldPathfinder.FindWorldPathToZone(world, start, end); var want = new List <Zone> { world.GetZoneByName("A"), world.GetZoneByName("C"), world.GetZoneByName("D") }; Assert.Equal(want.Count, got.Count); for (var i = 0; i < want.Count; i++) { Assert.Equal(want[i].Name, got[i].Name); } }