Example #1
0
        public DataLoader Clone()
        {
            DataLoader d = new DataLoader();
            d.Characters = new CharacterData[Characters.Length];
            d.Weapons = new WeaponData[Weapons.Length];
            d.Enemies = new EnemyData[Enemies.Length];

            for (int i = 0; i < Characters.Length; i++)
            {
                d.Characters[i].Name = Characters[i].Name;
                d.Characters[i].Description = Characters[i].Description;
                d.Characters[i].Overclocking = Characters[i].Overclocking;
                d.Characters[i].Locked = Characters[i].Locked;
                d.Characters[i].UnlockPoints = Characters[i].UnlockPoints;
            }

            for (int i = 0; i < Weapons.Length; i++)
            {
                d.Weapons[i].Name = Weapons[i].Name;
                d.Weapons[i].Description = Weapons[i].Description;
                d.Weapons[i].Locked = Weapons[i].Locked;
                d.Weapons[i].UnlockPoints = Weapons[i].UnlockPoints;
                d.Weapons[i].ClearedLevels = Weapons[i].ClearedLevels;
            }

            for (int i = 0; i < Enemies.Length; i++)
            {
                d.Enemies[i].Name = Enemies[i].Name;
                d.Enemies[i].Description = Enemies[i].Description;
                d.Enemies[i].Locked = false;
            }

            return d;
        }
Example #2
0
        public static void Intialize()
        {
            ExplosionParticleEffectSystem = new ParticleEffectSystem(BlendState.Additive);
            TrailParticleEffectSystem = new ParticleEffectSystem(BlendState.Additive);
            LightingSystemLayer = new LightingSystem();
            AdditiveWhiteLightLayer = new AdditiveWhiteImage(-0.015f);

            ExplosionParticleEffectSystem.LoadContent();
            TrailParticleEffectSystem.LoadContent();
            LightingSystemLayer.LoadContent();

            CurrentDrive = 1;
            CurrentLevel = 1;
            PlayerScore = 0;
            ClearedLevels = 0;
            SurvivalMode = -1;

            XmlSerializer xml = new XmlSerializer(typeof(DataLoader));
            StreamReader reader = new StreamReader(@"Content\GameData\GameData.xml");
            dataLoader = (DataLoader)xml.Deserialize(reader);
            reader.Close();

            xml = new XmlSerializer(typeof(DriveData));
            reader = new StreamReader(@"Content\GameData\DriveData.xml");
            driveData = (DriveData)xml.Deserialize(reader);
            reader.Close();

            lockedLevels = new List<bool>();

            survivalScores = new List<int>();
            for (int i = 0; i < SURVIVAL_TYPES; i++)
            {
                survivalScores.Add(0);
            }

            IsFirstTime = true;

            TopPlayerIndex = 0;
            BottomPlayerIndex = 0;
            TopWeaponIndex = 0;
            BottomWeaponIndex = 0;

            achievements = new Dictionary<Type, AchievementData>();
            xml = new XmlSerializer(typeof(GameAchievements));
            reader = new StreamReader(@"Content\GameData\AchievementData.xml");
            GameAchievements gameAch = (GameAchievements)xml.Deserialize(reader);
            reader.Close();

            foreach (AchievementData achievement in gameAch.Achievements)
            {
                achievements.Add(achievement.GetObjectType(), achievement.Clone());
            }

            for (int i = 0; i < DriveData.MAX_DRIVE_NUMBER; i++)
            {
                for (int j = 0; j < LevelData.MAX_LEVEL_DRIVE_NUMBER; j++)
                {
                    lockedLevels.Add(true);
                }
            }
            lockedLevels[0] = false;

            for (int i = 0; i < dataLoader.Enemies.Length; i++)
            {
                dataLoader.Enemies[i].Locked = true;
            }

            allPlayerData = new List<PlayerData>();
            primaryWeaponData = new List<BaseWeapon>();
            secondaryWeaponData = new List<BaseWeapon>();
            enemyNumberData = new Dictionary<Type, int>();

            allPlayerData.Add(new SmithData());
            allPlayerData.Add(new JessicaData());
            allPlayerData.Add(new JackData());
            allPlayerData.Add(new OmarData());
            allPlayerData.Add(new EbsData());
            allPlayerData.Add(new DieselData());

            primaryWeaponData.Add(new UziWeapon());
            primaryWeaponData.Add(new RifleWeapon());
            primaryWeaponData.Add(new EvaporatorWeapon());
            primaryWeaponData.Add(new FreezerWeapon());
            primaryWeaponData.Add(new TommygunWeapon());
            primaryWeaponData.Add(new GrenadeLauncherWeapon());
            primaryWeaponData.Add(new ShotgunWeapon());
            primaryWeaponData.Add(new MinigunWeapon());
            primaryWeaponData.Add(new RocketLauncherWeapon());
            primaryWeaponData.Add(new MineLauncherWeapon());
            primaryWeaponData.Add(new BulletGrenadeLauncherWeapon());
            primaryWeaponData.Add(new SpikeLauncherWeapon());
            primaryWeaponData.Add(new RifleXpWeapon());
            primaryWeaponData.Add(new HomingRocketLauncherWeapon());
            primaryWeaponData.Add(new HellgunWeapon());
            primaryWeaponData.Add(new XenaWeapon());
            primaryWeaponData.Add(new HellRocketLauncherWeapon());
            primaryWeaponData.Add(new MotherBombLauncherWeapon());

            foreach (BaseWeapon weapon in primaryWeaponData)
            {
                secondaryWeaponData.Add((BaseWeapon)Activator.CreateInstance(weapon.GetType()));
            }

            enemyNumberData.Add(typeof(VirusEnemy), 0);
            enemyNumberData.Add(typeof(ExeFile), 1);
            enemyNumberData.Add(typeof(TroyEnemy), 2);
            enemyNumberData.Add(typeof(MalzoneEnemy), 3);
            enemyNumberData.Add(typeof(HackintoshEnemy), 4);
            enemyNumberData.Add(typeof(PopurEnemy), 5);
            enemyNumberData.Add(typeof(ZipFile), 6);
            enemyNumberData.Add(typeof(DOSEnemy), 7);
            enemyNumberData.Add(typeof(WormEnemy), 8);
            enemyNumberData.Add(typeof(DocumentFile), 9);
            enemyNumberData.Add(typeof(Popur2Enemy), 10);
            enemyNumberData.Add(typeof(Troy2Enemy), 11);
            enemyNumberData.Add(typeof(SlowEnemy), 12);
            enemyNumberData.Add(typeof(Hackintosh2Enemy), 13);
            enemyNumberData.Add(typeof(DOS2Enemy), 14);
            enemyNumberData.Add(typeof(Malzone2Enemy), 15);
            enemyNumberData.Add(typeof(BouncerEnemy), 16);

            for (int i = 0; i < allPlayerData.Count; i++)
            {
                allPlayerData[i].LoadContent();
            }

            for (int i = 0; i < primaryWeaponData.Count; i++)
            {
                primaryWeaponData[i].LoadContent();
                secondaryWeaponData[i].LoadContent();
            }
        }