public override void OnProjectileHit(Projectile proj, Enemy target)
        {
            if (target != null)
                target.DamageEnemy(Damage, DamageType);

            DisposeOfProjectile(proj);
        }
 public override void LaunchAttack(Enemy Target)
 {
     if(Projectiles.Count <= MaxGlaives)
     {
         AudioManager.PlaySoundEffect(4);
         //Fire a projectile
         Projectiles.Add(new Projectile(this, Target, ProjectileSpeed, 35));
     }
 }
        public override void OnProjectileHit(Projectile proj, Enemy target)
        {
            if (Target != null)
            {
                Target.DamageEnemy(Damage, DamageType);
                Target.BeginBurn(burnPercent, burnDuration);
            }

            DisposeOfProjectile(proj);
        }
        public override void LaunchAttack(Enemy Target)
        {
            AudioManager.PlaySoundEffect(8);

            //Fire a projectile at each enemy in range.
            foreach (Enemy e in GameScene.Enemies)
            {
                if (Vector2.Distance(Position, e.Position) <= AttackRange && e.Visible && e.Alive)
                {
                    Projectiles.Add(new Projectile(this, e, ProjectileSpeed, 33));
                }
            }
        }
        public override void OnProjectileHit(Projectile proj, Enemy target)
        {
            if (target != null)
            {
                int finalDamage = Damage - (2 * proj.Bounces);
                target.DamageEnemy(finalDamage, DamageType);
                proj.Bounces++;
                proj.HitEnemies.Add(target);
                AudioManager.PlaySoundEffect(5);

                if (proj.Bounces > MaxBounces)
                    DisposeOfProjectile(proj);
                else
                {
                    //Find the next target to bounce to.
                    Random rand = new Random();
                    Enemy thisEnemy;

                    List<Enemy> oldEnemiesList = new List<Enemy>(GameScene.Enemies);
                    List<Enemy> newEnemiesList = new List<Enemy>();
                    while (oldEnemiesList.Count > 0)
                    {
                        thisEnemy = oldEnemiesList[rand.Next(0, oldEnemiesList.Count)];
                        oldEnemiesList.Remove(thisEnemy);
                        newEnemiesList.Add(thisEnemy);
                    }

                    //For each enemy, determine if it's in range.
                    foreach (Enemy e in newEnemiesList)
                    {
                        if (!proj.HitEnemies.Contains(e) && e.Alive && e.Visible && Vector2.Distance(proj.Position, e.Position) <= MaxBounceRange)
                        {
                            //Set the target to the first enemy found to be within range of the tower.
                            proj.SetNewTarget(e);
                            break;
                        }
                    }

                    //Since it's possible for the previous loop to not change the target, dispose of it if the target is the same as before.
                    if(proj.HitEnemies.Contains(proj.Target))
                        DisposeOfProjectile(proj);
                }
            }
        }
        public Projectile(Tower parent, Enemy target, float speed, int index, string name = "")
        {
            if (name != "")
                Name = name;

            Parent = parent;
            Target = target;
            Speed = speed;

            Position = parent.Position;

            //TEST
            SpriteIndex = index;

            Enabled = true;

            if (parent.Name == "Glaive Tower")
            {
                HitEnemies = new List<Enemy>();
                isGlaive = true;
            }

            curRotation += 90;
        }
 public override void LaunchAttack(Enemy Target)
 {
     AudioManager.PlaySoundEffect(3);
     //Fire a projectile
     Projectiles.Add(new Projectile(this, Target, ProjectileSpeed, 32));
 }
Example #8
0
        public override void OnProjectileHit(Projectile proj, Enemy target)
        {
            if (target != null)
            {
                target.BeginFreeze(slowAmount, freezeDuration);

                if (proj.Name != "Icicle")
                    target.DamageEnemy(Damage, DamageType);
                else if (proj.Name == "Icicle" && altDamage > 0)
                    target.DamageEnemy(altDamage, DamageType);

            }

            DisposeOfProjectile(proj);
        }
Example #9
0
 public void LaunchSecondaryAttack(Enemy Target)
 {
     AudioManager.PlaySoundEffect(7);
     //Fire a new projectile
     Projectiles.Add(new Projectile(this, Target, ProjectileSpeed, 36, "Icicle"));
 }
Example #10
0
 public void SetNewTarget(Enemy e)
 {
     Target = e;
 }
Example #11
0
 public Projectile(Tower parent, Enemy target, float speed)
     : this(parent, target, speed, 13)
 {
 }
Example #12
0
        public override void OnProjectileHit(Projectile proj, Enemy target)
        {
            if (Target != null)
            {
                Target.DamageEnemy(Damage, DamageType);

                //Start the target a-chokin'!
                //Use this formula to calculate the damage done.
                float poisonDPS = (Damage * 4) / poisonDuration;
                Target.BeginPoison(poisonDPS, poisonDuration);
            }

            DisposeOfProjectile(proj);
        }
 public QueuedSpawn(Enemy e, Point p)
 {
     enemy = e;
     spawnPoint = p;
 }
 //Spawns a specific enemy at a point (used for bosses)
 public static void SpawnAt(Enemy e, Point spawnAt)
 {
     Vector2 spawnVector = new Vector2(spawnAt.X * TileEngine.TileWidth, spawnAt.Y * TileEngine.TileHeight);
     e.Initialize(spawnVector);
 }
Example #15
0
 public virtual void OnProjectileHit(Projectile proj, Enemy target)
 {
     //Put stuff in here that will obliterate the projectile and thus the enemy.
 }
Example #16
0
 public virtual void LaunchAttack(Enemy Target)
 {
     //Actually launch an attack here
 }