コード例 #1
0
        public void Given_GetZone_When_WorldIsPopulated_Then_ReturnMinimallyPopulatedZone()
        {
            // Arrange
            Zone world = new Zone(0, 0);
            int sizeX = 10;
            int sizeY = 10;

            // Act
            world.Generate(sizeX, sizeY);
            var zone = world.GetZone(5, 5);

            // Assert
            Assert.AreNotEqual(ZoneType.None, zone.Type);
        }
コード例 #2
0
        public void Given_ZoneIn_When_WorldIsPopulated_Then_PopulateSubZoneAndReturnPopulatedZone()
        {
            // Arrange
            Zone world = new Zone(0, 0);
            int sizeX = 10;
            int sizeY = 10;

            // Act
            world.Generate(sizeX, sizeY);
            var zone = world.ZoneIn(x: 5,y: 5,sizeX: 10,sizeY: 10);
            var subZone = zone.GetZone(1,1);

            // Assert
            Assert.AreNotEqual(ZoneType.None, subZone.Type);
        }
コード例 #3
0
        public Zone ZoneIn(int x, int y, int sizeX, int sizeY, List<Actor> actorsZoning, Zone parentZone)
        {
            var result = this.GetZone(x, y);

            result.Parent = parentZone;
            result.Generate(sizeX, sizeY);

            // Add NonPlayer Actors

            // Assign Actor List
            result.Actors.AddRange(actorsZoning);

            return result;
        }