Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            if (_count % SPAWNTIME == 0)
            {
                _randNumb = _rand.Next(100, (Game1.ScreenWidth - 100));

                if (_rand.NextDouble() >= 0.5)
                {
                    LaserUpgrades.Add(new LaserWeaponUpgrade(_game, new Vector2(_randNumb, _position.Y)));
                }
                else
                {
                    RocketUpgrades.Add(new RocketWeaponUpgrade(_game, new Vector2(_randNumb, _position.Y)));
                }
            }

            _count++;

            foreach (LaserWeaponUpgrade LaserUpgrade in LaserUpgrades)
            {
                if (GameOver)
                {
                    LaserUpgrade.DisposeFromList();
                }
            }

            foreach (RocketWeaponUpgrade RocketUpgrade in RocketUpgrades)
            {
                if (GameOver)
                {
                    RocketUpgrade.DisposeFromList();
                }
            }
        }
Ejemplo n.º 2
0
 protected void Shoot()
 {
     if (currentUpgrade == null)
     {
         GameObject go     = (GameObject)Instantiate(standardBullet, gunTip.position, transform.rotation);
         Projectile bullet = go.GetComponent <Projectile> ();
         bullet.Shooter = this;
     }
     else
     {
         if (!currentUpgrade.Shoot(this, gunTip.position, transform.rotation))
         {
             currentUpgrade = null;
         }
     }
 }