public void ShouldHaveExtraPower()
        {
            var sut   = new EnemyFactory();
            var enemy = sut.Create(true);

            Assert.That(enemy, Has.Property("ExtraPower"));
        }
示例#2
0
        public void OnlyAllowKingOrQueenBossEnemies(EnemyFactory sut)
        {
            var ex =
                Assert.Throws <EnemyCreationException>(() => sut.Create("Zombie", true));

            Assert.Equal("Zombie", ex.RequestedEnemyName);
        }
示例#3
0
        public void CreateBossEnemy_CastReturnedTypeExample(EnemyFactory sut)
        {
            var enemy = sut.Create("Zombie King", true);
            var boss  = Assert.IsType <BossEnemy>(enemy);

            Assert.Equal("Zombie King", boss.Name);
        }
示例#4
0
        private static IEnumerator CoSpawnEnemy(Model.EnemyPlayer enemy, Vector2 pos)
        {
            var enemyPlayer = EnemyFactory.Create(enemy, pos);

            enemyPlayer.StartRun();
            yield return(new WaitForSeconds(UnityEngine.Random.Range(0.0f, 0.2f)));
        }
示例#5
0
    void Update()
    {
        UpdateUI();

        if (Input.GetKey("r"))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        _waveManager.ExecuteCurrentWave();
        if (_waveManager.CurrentWave.Ended)
        {
            // handle wave powerUp if present
            if (_waveManager.CurrentWave.Definition.HasPowerUp)
            {
                var pos         = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y);
                var powerUpType = _waveManager.CurrentWave.Definition.PowerUp;
                _powerUpFactory.Create(powerUpType, pos);
            }

            _waveManager.MoveNext();
        }

        if (_difficultyManager.CanCreateAsteroid())
        {
            _difficultyManager.NotifyEnemyTypeSelected(EnemyType.Asteroid1);
            var pos = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y);
            _enemyFactory.Create(EnemyType.Asteroid1, pos);
        }
    }
示例#6
0
        public void CreateNormalEnemyByDefault()
        {
            EnemyFactory sut   = new EnemyFactory();
            Enemy        enemy = sut.Create("Zombi");

            Assert.IsType <NormalEnemy>(enemy);
        }
示例#7
0
        public void CreateNormalEnemyByDefault_NotTypeExample()
        {
            EnemyFactory sut   = new EnemyFactory();
            Enemy        enemy = sut.Create("Zombi");

            Assert.IsNotType <DateTime>(enemy);
        }
示例#8
0
        public void NotAllowNullName()
        {
            EnemyFactory sut = new EnemyFactory();

            //Assert.Throws<ArgumentNullException>( () => sut.Create(null));
            Assert.Throws <ArgumentNullException>("name", () => sut.Create(null));
        }
示例#9
0
        public void CreateBossEnemy()
        {
            EnemyFactory sut   = new EnemyFactory();
            Enemy        enemy = sut.Create("Zombi King", true);

            Assert.IsType <BossEnemy>(enemy);
        }
示例#10
0
        public void ShouldCreateNormalEnemy()
        {
            var sut         = new EnemyFactory();
            var normalEnemy = sut.Create(false);

            Assert.That(normalEnemy, Is.TypeOf <NormalEnemy>());
        }
        public void NotAllowNullName()
        {
            //System Under Test
            EnemyFactory sut = new EnemyFactory();

            Assert.ThrowsException <ArgumentNullException>(() => sut.Create(null));
        }
示例#12
0
        public void ShouldCreateBossEnemy()
        {
            var sut       = new EnemyFactory();
            var bossEnemy = sut.Create(true);

            Assert.That(bossEnemy, Is.TypeOf <BossEnemy>());
        }
示例#13
0
        public void ShouldBeOfBaseType()
        {
            var sut       = new EnemyFactory();
            var bossEnemy = sut.Create(true);

            Assert.That(bossEnemy, Is.InstanceOf <IEnemy>());
        }
示例#14
0
        public void CreateBossEnemy_AssertAssignableTypes()
        {
            var sut   = new EnemyFactory();
            var enemy = sut.Create("Zombie King", true);

            Assert.IsAssignableFrom <Enemy>(enemy);
        }
示例#15
0
        public void CreateBossEnemy()
        {
            var enemy      = new EnemyFactory();
            var zombieBoss = enemy.Create("Zombie King", true);

            Assert.IsInstanceOfType(zombieBoss, typeof(BossEnemy));
        }
示例#16
0
        public void CreateNormalEnemyByDefault_NotType()
        {
            var sut   = new EnemyFactory();
            var enemy = sut.Create("Zombie");

            Assert.IsNotType <DateTime>(enemy);
        }
示例#17
0
        public void ShouldBeOfBaseType()
        {
            var    sut   = new EnemyFactory();
            object enemy = sut.Create(true);

            Assert.That(enemy, Is.InstanceOf <Enemy>());
        }
示例#18
0
        public void ShouldCreateNormalEnemy()
        {
            var sut = new EnemyFactory();

            object enemy = sut.Create(false);

            Assert.That(enemy, Is.TypeOf<NormalEnemy>());
        }
示例#19
0
        public void ShouldCreateNormalEnemy()
        {
            var sut         = new EnemyFactory();
            var enemy       = sut.Create(false);
            var normalEnemy = Assert.IsType <NormalEnemy>(enemy);

            Assert.Equal(10, normalEnemy.ExtraPower);
        }
示例#20
0
        public void ShouldBeOfBaseType()
        {
            var sut = new EnemyFactory();

            object enemy = sut.Create(true);

            Assert.That(enemy, Is.InstanceOf<Enemy>());            
        }
示例#21
0
        public void ShouldCreateBossEnemy()
        {
            var sut = new EnemyFactory();

            object enemy = sut.Create(true);

            Assert.That(enemy, Is.TypeOf<BossEnemy>());
        }
示例#22
0
                 public void CreateBossEnemy_CastReturnedType()
 
     {EnemyFactory sut=new EnemyFactory();
         Enemy enemy=sut.Create("Zombie King",true);
        BossEnemy boss= Assert.IsType<BossEnemy>(enemy);
        Assert.Equal("Zombie King",boss.Name);
         
     }
示例#23
0
        public void OnlyAllowKingOrQueenBossEnemies()
        {
            var sut = new EnemyFactory();

            var e = Assert.Throws <EnemyCreationException>(() => sut.Create("Dudda G", true));

            Assert.Equal("Dudda G", e.RequestedEnemyName);
        }
示例#24
0
        public void ShouldCreateNormalEnemy_Cast()
        {
            var test = new EnemyFactory();
            object enemy = test.Create(false);

            NormalEnemy normalEnemy = Assert.IsType<NormalEnemy>(enemy);
            Assert.Equal(10, normalEnemy.Power);
        }
        public void CreateBossEnemy()
        {
            EnemyFactory sut = new EnemyFactory();

            Enemy intrygator = sut.Create("Kingorator", true);

            Assert.IsType <NormalEnemy>(intrygator);
        }
示例#26
0
        public void CreateBossEnemyWhenAsked()
        {
            var sut = new EnemyFactory();

            var enemy = sut.Create("Zombie King", true);

            Assert.IsType <BossEnemy>(enemy);
        }
示例#27
0
        public void CreatNormalEnemyByDefault()
        {
            EnemyFactory ef = new EnemyFactory();

            Enemy e = ef.Create("Zombie");

            Assert.IsType <NormalEnemy>(e);
        }
        public void CreateNormalnEnemyByDefaultver2()
        {
            EnemyFactory sut = new EnemyFactory();

            Enemy enemy = sut.Create("Krwiopijca");

            Assert.IsNotType <DateTime>(enemy);
        }
示例#29
0
        public void CreateNormalEnemyByDefault()
        {
            EnemyFactory sut = new EnemyFactory();

            Enemy enemy = sut.Create("Zombie");

            Assert.IsInstanceOfType(enemy, typeof(NormalEnemy));
        }
示例#30
0
        public void CreateBossEnemy()
        {
            EnemyFactory sut = new EnemyFactory();

            Enemy enemy = sut.Create("Zombie King", true);

            Assert.IsInstanceOfType(enemy, typeof(BossEnemy));
        }
        public void IsThathBossName()
        {
            EnemyFactory sut = new EnemyFactory();

            EnemyCreationException ex = Assert.Throws <EnemyCreationException>(() => sut.Create("Zombie", true));

            Assert.Equal("Zombie", ex.RequestedEnemyName);
        }
示例#32
0
        public void BeASameInstanceForTwoObjects()
        {
            EnemyFactory sut = new EnemyFactory();

            Enemy enemy1 = sut.Create("Zombie");

            Assert.Same(enemy1, enemy1);
        }
示例#33
0
        public void CreateBossEnemy()
        {
            var systemUnderTest = new EnemyFactory();

            var enemy = systemUnderTest.Create("ZombieKing", true);

            Assert.IsInstanceOfType(enemy, typeof(BossEnemy));
        }
示例#34
0
        public void CreateNormalEnemyByDefault()
        {
            var systemUnderTest = new EnemyFactory();

            Enemy enemy = systemUnderTest.Create("Zombie");

            Assert.IsInstanceOfType(enemy, typeof(NormalEnemy));
        }
示例#35
0
        public void ShouldHaveExtraPower()
        {
            var sut = new EnemyFactory();

            object enemy = sut.Create(true);

            Assert.That(enemy, Has.Property("ExtraPower"));

            //Assert.That(enemy, Has.Property("SomeOtherProperty"));
        }
示例#36
0
        public void Load(IRace selectedPlayerRace)
        {
            //TODO implement diff levels //-> pass as parameter in methed the level create sweatch for levels and set for mapPath diff map resourse

            var mapPath = AppSettings.MapLevel1;
            var frientFactory = new FriendFactory();
            var enemyFactory = new EnemyFactory();

            this.PlayerRace = selectedPlayerRace;
            var width = AppSettings.MapElementSize.Width;
            var height = AppSettings.MapElementSize.Height;

            try
            {
                using (var reader = new StreamReader(mapPath))
                {
                    for (var row = 0; row < AppSettings.MapElementsCountY; row++)
                    {
                        var top = (row*height)+AppSettings.MapPosition.Top;

                        var line = reader.ReadLine();
                        for (var col = 0; col < AppSettings.MapElementsCountX; col++)
                        {
                            var left = col*width;

                            var currentsymbol = line[col];
                            switch (currentsymbol)
                            {
                                case 'p':
                                    this.Player = new Player(this.PlayerRace)
                                    {
                                        Position = new Position (left, top),
                                        Size = new Size(width, height)
                                    };
                                    break;

                                case 'f':
                                    this.Friend = (Friend)frientFactory.Create(_friendRace);
                                    this.Friend.Position = new Position(left, top);
                                    this.Friend.Size = new Size(width, height);
                                    break;

                                case 'e':
                                    var enemy = (Enemy)enemyFactory.Create(_enemyRace);
                                    enemy.Position = new Position (left, top);
                                    enemy.Size = new Size(width, height);
                                    this.Enemies.Add(enemy);
                                    break;

                                case 'w':
                                    var mazeElement = new MazeItem()
                                    {
                                        Position = new Position(left, top),
                                        Size = new Size(width, height)
                                    };
                                    this.Maze.Add(mazeElement);
                                    break;

                                case 'b':
                                    var beer = new BeerItem()
                                    {
                                        Position = new Position(left, top),
                                        Size = new Size(width, height)
                                    };
                                    this.ItemToCollect.Add(beer);
                                    break;

                                case 'l':
                                    var itemLife = new LifeItem()
                                    {
                                        Position = new Position(left, top),
                                        Size = new Size(width, height)
                                    };
                                    this.ItemToCollect.Add(itemLife);
                                    break;

                                case 'h':
                                    var itemHealth = new LargeHealthItem()
                                    {
                                        Position = new Position(left, top),
                                        Size = new Size(width, height)
                                    };
                                    this.ItemToCollect.Add(itemHealth);
                                    break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "BB Game MapLoader");
            }
        }
示例#37
0
 public void ShouldCreateNormalEnemy_Simple()
 {
     var test = new EnemyFactory();
     object enemy = test.Create(true);
     Assert.IsType(typeof(BossEnemy), enemy);
 }