Beispiel #1
0
        public void FindsEntityWhenExpected(short widthInTiles, short heightInTiles, short regionSize,
                                            Point entityLoc, Point targetLoc, int searchDist, bool expectToFind)
        {
            var map    = new RegionSpatialDictionary <IPlayer>(heightInTiles, widthInTiles, regionSize);
            var player = Container.Resolve <IPlayer>();

            player.Location = entityLoc;
            map.Add(player);

            var nearbyEntities = map.GetObjectsInProximity(targetLoc, searchDist);
            var found          = nearbyEntities.Contains(player);

            Assert.Equal(expectToFind, found);
        }
Beispiel #2
0
        public void CalculatesCorrectBase2BucketSize(int bucketSize, int expectedBase2BucketSize)
        {
            var map = new RegionSpatialDictionary <IPlayer>(MaxHeight, MaxWidth, bucketSize);

            Assert.Equal(expectedBase2BucketSize, map.BucketSize);
        }