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); }
public void FindClosestSignetPersonWhenTwoZonesAway() { var want = ExampleWorld.BastokSignetPerson(); var traveler = SetupWorld(); var got = traveler.SearchForClosestSignetNpc("Bastok", traveler.World.Npcs); Assert.Equal(want, got); }
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 override void Action(CommandCaller caller, string input, string[] args) { string key = "Mods.ExampleMod.VolcanoWarning"; Color messageColor = Color.Orange; NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); ExampleWorld exampleWorld = mod.GetModWorld <ExampleWorld>(); exampleWorld.VolcanoCountdown = ExampleWorld.DefaultVolcanoCountdown; exampleWorld.VolcanoCooldown = ExampleWorld.DefaultVolcanoCooldown; }
public override void Action(CommandCaller caller, string input, string[] args) { string message = "Did you hear something....A Volcano! Find Cover!"; Color messageColor = Color.Orange; NetMessage.SendData(25, -1, -1, message, 255, messageColor.R, messageColor.G, messageColor.B, 0); ExampleWorld exampleWorld = mod.GetModWorld <ExampleWorld>(); exampleWorld.VolcanoCountdown = ExampleWorld.DefaultVolcanoCountdown; exampleWorld.VolcanoCooldown = ExampleWorld.DefaultVolcanoCooldown; }
public void AddingPersonTriggersAdd() { var want = 1; var zone = ExampleWorld.ZoneD(); var actor = new SpyActor(); var watcher = new CollectionWatcher <Person>(zone.Npcs, actor); zone.Npcs.Add(new Person(2, "test guy", Vector3.Zero)); int got = actor.CalledTimesAdd; Assert.Equal(want, got); }
public void AllBorderZonesContainsAllBorderPoints() { var traveler = new Traveler { CurrentZone = ExampleWorld.ZoneB() }; var want = new List <Vector3> { new Vector3(0, 0, 1), new Vector3(1, 0, 1), new Vector3(1, 0, 0) }; var got = traveler.AllBorderZonePoints; Assert.Equal(want, got); }
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); } }