Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }