Example #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (attacking && bulletTimer >= 10)
            {
                if (target == null || !IsInRange(target.Center))
                {
                    attacking = false;
                }
                else
                {
                    GetTarget();

                    SplashBullet bullet = new SplashBullet(bulletTexture,
                                                           Vector2.Subtract(center, new Vector2(bulletTexture.Width / 2)),
                                                           rotation, damage, 40);

                    bulletList.Add(bullet);
                    soundBank.PlayCue("100772__CGEffex__Huge_rocket_launcher");
                    bulletTimer = 0;
                }
            }

            if (target != null)
            {
                GetTarget();
            }
        }
Example #2
0
        public void UpdateSplashDamage(List <Enemy> enemies, GameTime gameTime)
        {
            for (int i = 0; i < bulletList.Count; i++)
            {
                SplashBullet b = bulletList[i] as SplashBullet;
                b.SetRotation(rotation);
                b.Update(gameTime);

                if (target != null)
                {
                    if (target.IsHit(b))
                    {
                        List <Enemy> tempList = b.GetEnemiesInSplash(enemies);
                        foreach (Enemy enemy in tempList)
                        {
                            enemy.Intersects(b);
                        }

                        b.Kill();
                    }
                }


                if (!IsInRange(b.Center))
                {
                    b.Kill();
                }

                if (b.IsDead() || target == null)
                {
                    bulletList.Remove(b);
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (attacking && bulletTimer >= 10)
            {
                if (target == null || !IsInRange(target.Center))
                    attacking = false;
                else
                {
                    GetTarget();

                    SplashBullet bullet = new SplashBullet(bulletTexture,
                        Vector2.Subtract(center, new Vector2(bulletTexture.Width / 2)),
                        rotation, damage, 40);

                    bulletList.Add(bullet);
                    soundBank.PlayCue("100772__CGEffex__Huge_rocket_launcher");
                    bulletTimer = 0;
                }
            }

            if (target != null)
                GetTarget();
        }
Example #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Updates the 1and1 Tower. The Tower slows Enemies. </summary>
        ///
        /// <remarks>   Frost, 16.11.2010. </remarks>
        ///
        /// <param name="gameTime"> Time of the game. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (attacking && bulletTimer >= 5)
            {
                if (target == null || !IsInRange(target.Center))
                {
                    attacking = false;
                }
                else
                {
                    GetTarget();

                    SplashBullet bullet = new SplashBullet(bulletTexture,
                                                           Vector2.Subtract(center, new Vector2(bulletTexture.Width / 2)),
                                                           rotation, damage, 40);
                    //letzter zahl oben ist range

                    bulletList.Add(bullet);
                    bulletTimer = 0;
                }
            }

            if (target != null)
            {
                GetTarget();
            }
        }
Example #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Query if 'bullet' is hit. </summary>
        ///
        /// <remarks>   Frost, 16.11.2010. </remarks>
        ///
        /// <param name="bullet">   The bullet. </param>
        ///
        /// <returns>   true if hit, false if not. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public bool IsHit(SplashBullet bullet)
        {
            if (Vector2.Distance(center, bullet.Center) <= 12)
            {
                return(true);
            }
            return(false);
        }
Example #6
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Updates the splash damage. </summary>
        ///
        /// <remarks>   Frost, 16.11.2010. </remarks>
        ///
        /// <param name="enemies">  The enemies. </param>
        /// <param name="gameTime"> Time of the game. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void UpdateSplashDamage(List <Enemy> enemies, GameTime gameTime)
        {
            for (int i = 0; i < bulletList.Count; i++)
            {
                SplashBullet b = bulletList[i] as SplashBullet;
                b.SetRotation(rotation);
                b.Update(gameTime);

                if (target != null && !target.isSlow)
                {
                    if (target.IsHit(b))
                    {
                        List <Enemy> tempList = b.GetEnemiesInSplash(enemies);
                        foreach (Enemy enemy in tempList)
                        {
                            enemy.Intersects(b);
                            // slowenemy
                            slowEnemy(enemy, 0.8f);
                        }

                        b.Kill();
                        soundBank.PlayCue("30935__aust_paul__possiblelazer");
                    }
                }


                if (!IsInRange(b.Center))
                {
                    b.Kill();
                }

                if (b.IsDead() || target == null)
                {
                    bulletList.Remove(b);
                }
            }
        }
Example #7
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Query if 'bullet' is hit. </summary>
 ///
 /// <remarks>   Frost, 16.11.2010. </remarks>
 ///
 /// <param name="bullet">   The bullet. </param>
 ///
 /// <returns>   true if hit, false if not. </returns>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public bool IsHit(SplashBullet bullet)
 {
     if (Vector2.Distance(center, bullet.Center) <= 12)
         return true;
     return false;
 }
Example #8
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Intersects. </summary>
 ///
 /// <remarks>   Frost, 16.11.2010. </remarks>
 ///
 /// <param name="bullet">   The bullet. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void Intersects(SplashBullet bullet)
 {
     health -= (float)bullet.Damage;
 }
Example #9
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Intersects. </summary>
        ///
        /// <remarks>   Frost, 16.11.2010. </remarks>
        ///
        /// <param name="bullet">   The bullet. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void Intersects(SplashBullet bullet)
        {
            health -= (float)bullet.Damage;
        }