Esempio n. 1
0
        public void AttachLaserSightDecoratesGunWithLaserSight()
        {
            AbstractGun gun = gunShop.Buy(1);

            gun = gunShop.AttachLaserSight(gun as Gun);
            Assert.IsTrue(gun.ToString().ToLower().Contains("laser sight"));
        }
Esempio n. 2
0
        public void AttachHoloSightDecoratesGunWithHolographicSight()
        {
            AbstractGun gun = gunShop.Buy(1);

            gun = gunShop.AttachHoloSight(gun as Gun);
            Assert.IsTrue(gun.ToString().ToLower().Contains("holographic sight"));
        }
Esempio n. 3
0
        public void AttachSilencerDecoratesGunWithSilencer()
        {
            AbstractGun gun = gunShop.Buy(1);

            gun = gunShop.AttachSilencer(gun as Gun);
            Assert.IsTrue(gun.ToString().ToLower().Contains("silencer"));
        }
Esempio n. 4
0
 public void AddMultipleAttachments()
 {
     gun = new LaserSight(gun);
     gun = new HoloSight(gun);
     gun = new Silencer(gun);
     Assert.IsTrue(gun.ToString().Contains("Laser sight") &&
                   gun.ToString().Contains("Holographic sight") &&
                   gun.ToString().Contains("Silencer") &&
                   gun.Value() > gun.BasePrice);
 }
    public AbstractGun GetNextGun(AbstractGun previousGun)
    {
        int nextGunIndex = guns.IndexOf(previousGun) + 1;

        if ((nextGunIndex + 1) > guns.Count)
        {
            return(guns[0]);
        }
        else
        {
            return(guns[nextGunIndex]);
        }
    }
Esempio n. 6
0
    void Start()
    {
        _currentGun = FindObjectOfType <AbstractGun>();
        //subcrible to gunSwap event
        FindObjectOfType <DefaultTurretController>().gunSwap += FindCurrentGunOnTurret;
        _healthBar.maxValue     = health;
        _healthBar.wholeNumbers = true;
        _healthBar.value        = health;

        if (gameObject.CompareTag("AirEnemy"))
        {
            _enemyScore = 20;
        }
        else
        {
            _enemyScore = 10;
        }
    }
 void Start()
 {
     _currentGun = FindObjectOfType <AbstractGun>();
     FindObjectOfType <DefaultTurretController>().gunSwap += FindGunInfo;
 }
Esempio n. 8
0
 public Attachment(AbstractGun gun)
 {
     _gun = gun;
 }
Esempio n. 9
0
 protected void FindCurrentGunOnTurret()
 {
     _currentGun = FindObjectOfType <AbstractGun>();
 }
Esempio n. 10
0
 public LaserSight(AbstractGun gun) : base(gun)
 {
     AdditionalValue = 100m;
 }
Esempio n. 11
0
 public Silencer(AbstractGun gun) : base(gun)
 {
     AdditionalValue = 50m;
 }
Esempio n. 12
0
 public void AddLaserSight()
 {
     gun = new LaserSight(gun);
     Assert.IsTrue(gun.ToString().Contains("Laser sight") && gun.Value() > gun.BasePrice);
 }
Esempio n. 13
0
 public void AddHolographicSight()
 {
     gun = new HoloSight(gun);
     Assert.IsTrue(gun.ToString().Contains("Holographic sight") && gun.Value() > gun.BasePrice);
 }
Esempio n. 14
0
 public void AddSilencer()
 {
     gun = new Silencer(gun);
     Assert.IsTrue(gun.ToString().Contains("Silencer") && gun.Value() > gun.BasePrice);
 }
Esempio n. 15
0
 public void Initialize()
 {
     gun = GunFactory.Instance.Construct(new AK47Builder());
 }
Esempio n. 16
0
 public HoloSight(AbstractGun gun) : base(gun)
 {
     AdditionalValue = 150m;
 }
Esempio n. 17
0
 private void FindGunInfo()
 {
     _currentGun = FindObjectOfType <AbstractGun>();
 }
Esempio n. 18
0
 public void NextGun()
 {
     currentGun = weaponList.GetNextGun(currentGun);
     ShowCurrentWeapon(true);
 }
Esempio n. 19
0
 public void SetGun(string gunName)
 {
     currentGun = weaponList.SetGun(gunName);
     ShowCurrentWeapon(true);
 }
Esempio n. 20
0
 public void Cleanup()
 {
     gun = null;
 }
Esempio n. 21
0
 public void Start()
 {
     currentGun = weaponList.GetDefaultWeapon();
 }