Пример #1
0
    public void Shoot()
    {
        var rocketRb = Bazooka.Instantiate(this.rocketPrefab, this.rocketSpawn.position, this.rocketSpawn.rotation).GetComponent <Rigidbody2D>();
        var force    = this.rocketSpawn.up * this.forceMagnitude;

        rocketRb.AddForce(force);
        this.rb.velocity = -force / dampFactor;
    }
Пример #2
0
        public void AddMoreThanMaxAmmoToBazooka()
        {
            Weapon testWeapon = new Bazooka();

            testWeapon.AddAmmo(3);

            Assert.AreEqual(2, testWeapon.ammoRemaining);
        }
        public void TestEnemyIsNotAlive()
        {
            Weapon testWeapon = new Bazooka();
            Enemy  testEnemy  = new Sergeant();

            testWeapon.Shoot(testEnemy);
            Assert.IsFalse(testEnemy.Alive);
        }
Пример #4
0
        public void AddLessThanMaxAmmoToBazooka()
        {
            Weapon testWeapon = new Bazooka();

            testWeapon.SetAmmo(0);
            testWeapon.AddAmmo(1);

            Assert.AreEqual(1, testWeapon.ammoRemaining);
        }
        private static void UseBazooka()
        {
            IWeapon weapon = new Bazooka();

            var player = new Player(weapon);

            player.Shoot();
            player.Reload();
        }
Пример #6
0
        public void ShootGruntWithBazooka()
        {
            Weapon testWeapon = new Bazooka();
            Enemy  testEnemy  = new Grunt();

            testWeapon.Shoot(testEnemy);
            int test = Grunt.Grunt_Starting_Energy - Bazooka.Bazooka_Damage_Points;

            Assert.AreEqual(test, testEnemy.EnergyRemaining);
        }
        public void ShootTankWithGunThatDoesDamage()
        {
            Weapon testWeapon = new Bazooka();
            Enemy  testEnemy  = new Tank();

            testWeapon.Shoot(testEnemy);
            int test = Tank.Tank_Starting_Energy - Bazooka.Bazooka_Damage_Points;

            Assert.AreEqual(test, testEnemy.EnergyRemaining);
        }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Destroy(gameObject);
            Destroy(Grenade);

            foreach (Transform child in Player)
            {
                if (child.tag == "Bazooka")
                {
                    Bazooka bazooka = child.GetComponent <Bazooka>();
                    bazooka.ammoLeft += 15;
                    bazooka.bazookaAmmoLeftValueText.text = Convert.ToString(bazooka.ammoLeft);
                }
            }
        }
    }
Пример #9
0
        private static void BridgeExample()
        {
            Logger.Instance.Info("Running Bridge Example");

            var mockPosition   = Vector2.Zero;
            var mockMap        = new Map(16, 16);
            var mockPathFinder = new PathFindingAdapter(mockMap);
            var enemyState     = new EnemyStateFactory();

            IPlayer player  = new Player1();
            IWeapon bazooka = new Bazooka();
            IWeapon pistol  = new Pistol();

            Enemy enemyAWithBazooka = new EnemyA(mockPathFinder, bazooka, player, 50, mockPosition, null, enemyState.GetState("Moving"), mockMap);
            Enemy enemyBWithPistol  = new EnemyB(mockPathFinder, pistol, player, 50, mockPosition, null, enemyState.GetState("Moving"), mockMap);

            enemyAWithBazooka.Attack();
            enemyBWithPistol.Attack();
        }
Пример #10
0
 public void Create_Guns(string type)
 {
     if (type == "S")
     {
         Sniper temp = WeaponsFacotry.CreateWeapon(type) as Sniper;
         Assert.AreEqual(10, temp.ammo);
         Assert.AreEqual("AWP", temp.name);
         Assert.AreEqual(75, temp.damage);
         Assert.AreEqual(900, temp.cost);
     }
     else if (type == "A")
     {
         Automat temp = WeaponsFacotry.CreateWeapon(type) as Automat;
         Assert.AreEqual(30, temp.ammo);
         Assert.AreEqual("AK-47", temp.name);
         Assert.AreEqual(45, temp.damage);
         Assert.AreEqual(750, temp.cost);
     }
     else if (type == "P")
     {
         Pistol temp = WeaponsFacotry.CreateWeapon(type) as Pistol;
         Assert.AreEqual(7, temp.ammo);
         Assert.AreEqual("Desert Eagle", temp.name);
         Assert.AreEqual(30, temp.damage);
         Assert.AreEqual(500, temp.cost);
     }
     else if (type == "B")
     {
         Bazooka temp = WeaponsFacotry.CreateWeapon(type) as Bazooka;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("RukyBazuky", temp.name);
         Assert.AreEqual(100, temp.damage);
         Assert.AreEqual(1000, temp.cost);
     }
     else
     {
         Granade temp = WeaponsFacotry.CreateWeapon(type) as Granade;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("small", temp.name);
         Assert.AreEqual(10, temp.damage);
         Assert.AreEqual(0, temp.cost);
     }
 }
Пример #11
0
 private void Reset()
 {
     this.bazooka = this.GetComponentInChildren <Bazooka>();
 }
Пример #12
0
 public AIControl(Ballz game, Session match, Ball ball) :
     base(game, match, ball)
 {
     pistol = new Pistol(ball, game);
     bazoo  = new Bazooka(ball, game);
 }