Ejemplo n.º 1
0
        public void _0_VisitLight()
        {
            IVisitor   bullet = new TankBullet();
            ILightUnit light  = new Marine();

            light.Accept(bullet);

            Assert.AreEqual(100 - 21, light.Health);
        }
Ejemplo n.º 2
0
        public void _1_VisitArmored()
        {
            IVisitor     bullet  = new TankBullet();
            IArmoredUnit armored = new Marauder();

            armored.Accept(bullet);

            Assert.AreEqual(125 - 32, armored.Health);
        }
Ejemplo n.º 3
0
    private void Shoot()
    {
        GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);

        TankBullet bullet = bulletGO.GetComponent <TankBullet>();

        if (bullet != null)
        {
            bullet.Seek(target);
        }
    }
Ejemplo n.º 4
0
    void Shoot()
    {
        GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
        TankBullet bullet   = bulletGO.GetComponent <TankBullet>();

        if (bullet == null)
        {
            return;
        }
        bullet.Seek(target);
        GameManager.instance.soundManager.PlaySound("FuturisticWeaponsSet/hand_gun/shot_hand_gun");
    }
Ejemplo n.º 5
0
    void Fire()
    {
        if (fireReloadCount <= 0f)
        {
            bulletPrefab.speed  = stats.bulletSpeed;
            bulletPrefab.damage = stats.bulletDamage;
            TankBullet tb = Instantiate(bulletPrefab, bulletPoint.position, transform.rotation);
            Destroy(tb.gameObject, stats.bulletDurability);
            fireReloadCount = stats.reloadSpeed;

            fireAudio.Play();
        }
    }
Ejemplo n.º 6
0
    void shoot()
    {
        shootSound.Play();
        fireEffect.SetActive(true);
        Invoke("turnOffEffect", .1f);
        var bullet = bulletPool.GetObject();

        bullet.SetActive(true);
        bullet.transform.position = barrel.transform.position;
        bullet.transform.up       = barrel.transform.up;
        Vector2 vel = bullet.transform.up * bulletSpeed;

        bullet.GetComponent <Rigidbody2D>().velocity = vel;
        TankBullet bulletProperties = bullet.GetComponent <TankBullet>();

        bulletProperties.playerNum = playerNum;
        bulletProperties.score     = score;
        bullet.GetComponent <SpriteRenderer>().sprite = bulletSprite;
    }
Ejemplo n.º 7
0
    public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans)
    {
        currentSpecialAmmo--;


        //Bullet Spawning
        var bullet = PowerUpPool.GetObject();

        bullet.SetActive(true);
        bullet.transform.position = spawnTrans.transform.position;
        bullet.transform.up       = spawnTrans.transform.up;
        Vector2 vel = bullet.transform.up * bulletSpeed;

        bullet.GetComponent <Rigidbody2D>().velocity = vel;

        //Score and Owner
        TankBullet bulletProperties = bullet.GetComponent <TankBullet>();

        bulletProperties.frontalDamage = frontDamage;
        bulletProperties.normalDamage  = normalDamage;
        bulletProperties.playerNum     = playerNum;
        bulletProperties.score         = score;
    }
Ejemplo n.º 8
0
    //Убийство цели
    public void DeathTarget()
    {
        if (heath > 0)
        {
            heath = 0;
        }

        achievement.plus_1_destroy_object();
        player_save.PlusCombo();

        //Уменьшаем вес
        Rigidbody rigidbody = gameObject.GetComponent <Rigidbody>();

        if (rigidbody != null)
        {
            //Размораживаем
            rigidbody.constraints = RigidbodyConstraints.None;
        }

        HingeJoint hingeJoint = gameObject.GetComponent <HingeJoint>();

        if (hingeJoint != null)
        {
            GameObject.Destroy(hingeJoint);
        }

        //Если есть частицы смерти
        if (particleDie != null)
        {
            particleDie.Play();
        }

        //Воспросизводим звук смерти
        TargetSound sounds = gameObject.GetComponent <TargetSound>();

        if (sounds != null)
        {
            gameObject.GetComponent <TargetSound>().PlaySoundDestroy();
        }

        //Спавним обьект после смерти
        if (ObjSpawnDie != null)
        {
            GameObject DieObj = Instantiate(ObjSpawnDie, gameObject.transform.parent);
            DieObj.transform.position = gameObject.transform.position;
        }

        //Если это постройка
        BildTarget bild = gameObject.GetComponent <BildTarget>();

        if (bild != null)
        {
            bild.need_destroy = true;
        }
        //Если цель автомобиль
        CarStatic CarSiren = gameObject.GetComponent <CarStatic>();

        if (CarSiren != null)
        {
            CarSiren.OffSignal();
        }

        //Если это автомобиль
        Automobile automobile = gameObject.GetComponent <Automobile>();

        if (automobile != null && rigidbody != null)
        {
            rigidbody.mass = rigidbody.mass / 100;

            police_car police = gameObject.GetComponent <police_car>();
            if (police != null && achievement != null)
            {
                achievement.plus_1_destroy_police();
            }
        }

        //Если это танк
        Tank tank = gameObject.GetComponent <Tank>();

        if (tank != null)
        {
            tank.BrokenTank();
        }
        //Если это пуля танка
        TankBullet tankBullet = gameObject.GetComponent <TankBullet>();

        if (tankBullet != null)
        {
            tankBullet.testBoom = true;
        }

        flyer fly = gameObject.GetComponent <flyer>();

        if (fly != null && achievement != null)
        {
            achievement.destroy_fighter();
        }

        //Взрываем
        BoomTarget boom = gameObject.GetComponent <BoomTarget>();

        if (boom != null)
        {
            boom.BOOM();
        }

        //Убиваем все дочерние обьекты
        //PiiTarget[] piiTargets = gameObject.GetComponentsInChildren<PiiTarget>();
        //if (piiTargets != null) {
        //    for (int num = 0; num < piiTargets.Length; num++) {
        //        if (piiTargets[num] != gameObject.GetComponent<PiiTarget>()) {
        //            piiTargets[num].DeathTarget();
        //        }
        //   }
        //}

        //убиваем все дочерние обьекты по новому
        if (SiskoTarget != null && SiskoTarget.Length != 0)
        {
            for (int x = 0; x < SiskoTarget.Length; x++)
            {
                if (SiskoTarget[x] != null && SiskoTarget[x].heath > 0)
                {
                    SiskoTarget[x].DeathTarget();
                }
            }
        }
    }