public static void InitializeWaveController()
        {
            EnemyTypePeakWidth = new int[5];
            EnemyTypeExpectedWavePeak = new int[5];
            spawnChances = new double[5];

            // Increase number to make units appear at later waves.
            EnemyTypeExpectedWavePeak[0] = 0;
            EnemyTypeExpectedWavePeak[1] = 40;
            EnemyTypeExpectedWavePeak[2] = 80;
            EnemyTypeExpectedWavePeak[3] = 80;
            EnemyTypeExpectedWavePeak[4] = 100;

            //  Increase numbers to increase spread.
            EnemyTypePeakWidth[0] = 70;
            EnemyTypePeakWidth[1] = 40;
            EnemyTypePeakWidth[2] = 37;
            EnemyTypePeakWidth[3] = 30;
            EnemyTypePeakWidth[4] = 30;

            // Increase number to make units appear at later waves.

            randomGenerator = new Random();
            mWaveEnemies = new JTargetQueue();
            randomNumber = 0;

            mNumberOfEnemies += (int)(Math.Pow(waveNumber, 0.8));

            PopulateWaveEnemies();
        }
Example #2
0
        // Update is called from Game Controller as this object is passed in the projectile list
        public void Update(GameTime gameTime)
        {
            mTargetDirection = -this.Sprite.WorldPosition;

            mTargetDirection = this.mCurrentTarget - this.Sprite.WorldPosition;
            mTargetDirection.Normalize();

            this.Direction = this.Direction + mTargetDirection * mSpeed;

            if (this.mDirection.Length() > 0.0f)
            {
                this.mDirection.Normalize();
            }
            this.mSprite.WorldPosition = this.mSprite.WorldPosition + this.mDirection * mSpeed;

            if ((this.Sprite.WorldPosition.X >= mCurrentTarget.X - 30 &&
                       this.Sprite.WorldPosition.Y >= mCurrentTarget.Y - 30) &&
                      (this.Sprite.WorldPosition.X <= mCurrentTarget.X + 30 &&
                       this.Sprite.WorldPosition.Y <= mCurrentTarget.Y + 30))
            {
                mHasLanded = true;
                if (mProjectileTargetObject is Enemy)
                {
                    Enemy tempEnemyTarget = (Enemy)mProjectileTargetObject;
                    tempEnemyTarget.EnemyAttribute.CurrentHealthPoints -= mProjectileDamage;
                    PlayUnitStruckAudio(tempEnemyTarget);
                    if (mProjectileCaster.CreatureType == ObjectType.NECROMANCER)
                    {
                        int counter = 0;
                        JTargetQueue HealList = new JTargetQueue();
                        Friendly tempNecromancer = (Friendly)mProjectileCaster;
                        mPotentialTargetListList.Reset();
                        for (int i = 0; i < mPotentialTargetListList.GetCount(); i++)
                        {
                            if ((mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY) &&
                                mPotentialTargetListList.GetCurrent().gameObject.Sprite.SpriteFrame.Contains(tempNecromancer.FieldOfView))
                            {
                                HealList.InsertTarget(mPotentialTargetListList.GetCurrent().gameObject);
                                counter++;
                            }

                            mPotentialTargetListList.NextNode();
                        }

                        while (!HealList.IsEmpty())
                        {
                            if (HealList.PeekFirst() is Friendly)
                            {
                                Friendly tempFriendly = (Friendly)HealList.PopTarget();
                                tempFriendly.FriendlyAttribute.CurrentHealthPoints += mProjectileDamage / counter;
                            }
                            if (HealList.PeekFirst() is Hero)
                            {
                                Hero tempHero = (Hero)HealList.PopTarget();
                                tempHero.HeroAttribute.CurrentHealthPoints += mProjectileDamage / counter;
                            }
                        }

                    }
                }
                else if (mProjectileTargetObject is Friendly)
                {
                    Friendly tempFriendlyTarget = (Friendly)mProjectileTargetObject;
                    PlayUnitStruckAudio(tempFriendlyTarget);
                    tempFriendlyTarget.FriendlyAttribute.CurrentHealthPoints -= mProjectileDamage;
                }
                else if (mProjectileTargetObject is Castle)
                {
                    Castle tempCastleTarget = (Castle)mProjectileTargetObject;
                    tempCastleTarget.CastleAttribute.CurrentHealthPoints -= mProjectileDamage;
                }
                else if (mProjectileTargetObject is Structure)
                {
                    Structure tempStructureTarget = (Structure)mProjectileTargetObject;
                    tempStructureTarget.StructureAttribute.CurrentHealthPoints -= mProjectileDamage;
                }
                else if (mProjectileTargetObject is Hero)
                {
                    Hero tempHeroTarget = (Hero)mProjectileTargetObject;
                    tempHeroTarget.HeroAttribute.CurrentHealthPoints -= mProjectileDamage;
                    PlayUnitStruckAudio(tempHeroTarget);
                }

            }

            CheckSpriteAnimation();
        }