Inheritance: Actor
        public Projectile(WeaponStats stats, Creep targetCreep, Vector2 startPoint, TowerTypes parentTowerType)
        {
            Stats = stats.GetCopy();
            TargetCreep = targetCreep;

            CenterPosition = startPoint;

            this.type = SelectTypeBasedOnTowerType(parentTowerType);
            this.TextureID =  TowerFactory.GetProjectileMediaID(type);

            this.numFrames = ProjectileDefinitions.ProjectileStats[type].NumFrames;
        }
Exemple #2
0
        /// <summary>
        /// The update loop.
        /// </summary>
        public override void Update()
        {
            if (null != waveManager)
            {
                //if (waveManager.Update(creeps.Count == 0))
                //{
                //    creeps.Add(new Creep(CreepDefinitions.ProjectileStats[(CreepType)waveManager.waves[waveManager.currentWave][waveManager.nextSpawnIndex - 1][0]], new Vector2(paths[0][0].X, paths[0][0].Y), (MEDIA_ID)waveManager.waves[waveManager.currentWave][waveManager.nextSpawnIndex - 1][0], 0, 0));
                //    if (waveManager.GameWon)
                //    {
                //        GameEngine.RunningEngine.Load(Screens.WIN);
                //        return;
                //    }
                //}
                if (waveManager.InfiniteUpdate(creeps.Count == 0))
                {
                    double boost = Math.Pow(1.2, waveManager.BonusWave);

                    CreepTypeData creepNormal = new CreepTypeData(){DamageToPlayer = 1, Health = (int)boost * 5, Height = 16, Width = 16, Speed = 3};
                    CreepTypeData creepFast = new CreepTypeData(){DamageToPlayer = 1, Health =(int)boost * 4, Height = 32, Width = 32, Speed = 5};
                    CreepTypeData creepVariant = new  CreepTypeData(){DamageToPlayer = 1, Health = (int)boost * 5, Height = 32, Width = 32, Speed = 4};
                    CreepTypeData creepBoss = new CreepTypeData(){DamageToPlayer = 2, Health = (int)boost * 40, Height = 32, Width = 32, Speed = 3};

                    // What is this?
                    int thing = waveManager.BonusWave % 4;
                    Creep newCreep;

                    switch (thing)
                    {
                        case 0:
                            newCreep = new Creep(creepNormal, new Vector2(paths[0][0].X, paths[0][0].Y), MEDIA_ID.CREEP_0);
                            break;
                        case 1:
                             newCreep = new Creep(creepFast, new Vector2(paths[0][0].X, paths[0][0].Y), MEDIA_ID.CREEP_1);
                            break;
                        case 2:
                            newCreep = new Creep(creepVariant, new Vector2(paths[0][0].X, paths[0][0].Y), MEDIA_ID.CREEP_2);
                            break;
                        default:
                            newCreep = new Creep(creepBoss, new Vector2(paths[0][0].X, paths[0][0].Y), MEDIA_ID.CREEP_3);
                            break;
                    }

                    creeps.Add(newCreep);
                }
            }

            HandleCreepLoop();
            HandleTowerLoop();
            HandleProjectileLoop();
            HandleInput();
        }