Esempio n. 1
0
        public static void NewGame(bool HumanDirector, int survivors)
        {
            //Reset all the things we need to reset
            Director = null;
            SurvivorList.Clear();
            WorldDirector.LevelCounter = 0;
            //Reset everything in the world
            GameEntities.Clear();
            NewEntities.Clear();
            AddedEntities.Clear();
            BulletList.Clear();
            ZombieList.Clear();
            AliveSurvivorList.Clear();
            //Reset the psawning counter
            WorldDirector.spawningcounter = 0;
            //If the director is human
            if (HumanDirector)
            {
                Add(new Director(Director.DirectorPersonality.Human));
                //Now start adding the survivors
                switch (survivors)
                {
                case 2:
                {
                    Add(new Survivor(PlayerIndex.One));
                    break;
                }

                case 3:
                {
                    Add(new Survivor(PlayerIndex.One));
                    Add(new Survivor(PlayerIndex.Three));
                    break;
                }

                case 4:
                {
                    Add(new Survivor(PlayerIndex.One));
                    Add(new Survivor(PlayerIndex.Three));
                    Add(new Survivor(PlayerIndex.Four));
                    break;
                }
                }
            }
            else
            {
                //Check the amount of survivors and spawn the number of survivors
                switch (survivors)
                {
                case 1:
                {
                    Add(new Survivor(PlayerIndex.One));
                    break;
                }

                case 2:
                {
                    Add(new Survivor(PlayerIndex.One));
                    Add(new Survivor(PlayerIndex.Two));
                    break;
                }

                case 3:
                {
                    Add(new Survivor(PlayerIndex.One));
                    Add(new Survivor(PlayerIndex.Two));
                    Add(new Survivor(PlayerIndex.Three));
                    break;
                }

                case 4:
                {
                    Add(new Survivor(PlayerIndex.One));
                    Add(new Survivor(PlayerIndex.Two));
                    Add(new Survivor(PlayerIndex.Three));
                    Add(new Survivor(PlayerIndex.Four));
                    break;
                }
                }
                //So it's an AI, pick one of the three personalities
                switch (ExtensionMethods.RandomNumber(1, 3))
                {
                case 1:
                {
                    Director dir = new Director(Director.DirectorPersonality.Swarmer);
                    Director = dir;
                    Add(Director);
                    break;
                }

                case 2:
                {
                    Director dir = new Director(Director.DirectorPersonality.Spammer);
                    Director = dir;
                    Add(Director);
                    break;
                }

                case 3:
                {
                    Director dir = new Director(Director.DirectorPersonality.Bully);
                    Director = dir;
                    Add(Director);
                    break;
                }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Override Logic method
        /// </summary>
        public override void Logic()
        {
            //Go through every survivor
            foreach (Survivor surv in World.AliveSurvivorList)
            {
                //If the survivor has more kills than the target
                if (Target.Kills < surv.Kills && surv.IsAlive)
                {
                    //Set that survivor to be the target
                    Target = surv;
                }
            }
            //If the Director has enough resources
            if (World.Director.Resources >= 10000)
            {
                while (World.Director.Resources > 500)
                {
                    //Use either the slow or speed up
                    if (ExtensionMethods.RandomNumber(1, 10) == 5)
                    {
                        //Slow the players
                        SpeedEffect.Instance.Activate();
                    }
                    if (ExtensionMethods.RandomNumber(1, 10) == 2)
                    {
                        //Make the zombies go faster
                        SlowEffect.Instance.Activate();
                    }
                    //Spawn a new common zomibie, one in ten chance
                    if (ExtensionMethods.RandomNumber(1, 10) == 2)
                    {
                        //Try and spawn a common zombie
                        WorldDirector.ZombieSpawner("cm");
                    }
                    //Spawn a juggernaught, one in ten
                    if (ExtensionMethods.RandomNumber(1, 10) == 7)
                    {
                        //Try and spawn a common zombie
                        WorldDirector.ZombieSpawner("j");
                    }
                    //Spawn an exploder, one in ten
                    if (ExtensionMethods.RandomNumber(1, 10) == 4)
                    {
                        //Try and spawn a common zombie
                        WorldDirector.ZombieSpawner("e");
                    }
                    //Spawn a speeder, one in ten
                    if (ExtensionMethods.RandomNumber(1, 10) == 3)
                    {
                        //Try and spawn a common zombie
                        WorldDirector.ZombieSpawner("s");
                    }
                }
            }

            //If the director can spawn a weapon, do it
            if (World.Director.CanSpawnWeapon)
            {
                SpawnWeaponEffect.Instance.Activate();
            }
        }