Пример #1
0
        private ZombieSprite CreateNewZombieSprite()
        {
            ZombieSprite zombieSprite = new ZombieSprite(this.Game, RandomZombieSpawnLocation(), 0, RandomHelper.NextRandomSingle());

            this.AddZombieSprite(zombieSprite);
            return(zombieSprite);
        }
Пример #2
0
 // TODO: Make private
 public void AddZombieSprite(ZombieSprite zombieSprite)
 {
     Game.SpritesDrawingManager.DrawableEntities.Add(zombieSprite);
     ZombiesUpdateManger.UpdatableEntities.Add(zombieSprite);
     ZombiesCollisionManager.CollidableEntities.Add(zombieSprite);
     ZombiesAttackManager.AttackableEntities.Add(zombieSprite);
     ZombieSprites.Add(zombieSprite);
 }
        private void StartPlayingSavedGame(GameSaveStruct saveStruct)
        {
            this.Options = new GameOptions(saveStruct.Options);
            this.StartPlayingGame();

            SurvivorSubsystem.AddPlayerOneSurvivorSprite(new SurvivorSprite(this, saveStruct.PlayerOneSurvivorSprite));
            foreach (ZombieSpriteSaveStruct zombieSpriteSaveStruct in saveStruct.ZombieSprites)
            {
                ZombieSprite zombieSprite = new ZombieSprite(this, zombieSpriteSaveStruct);
                ZombiesSubsystem.AddZombieSprite(zombieSprite);
            }

            foreach (CollectableSaveStruct collectableSaveStruct in saveStruct.Collectables)
            {
                CollectablesSubsystem.AddCollectable(new Collectable(this, collectableSaveStruct));
                switch (collectableSaveStruct.CollectableEntityType)
                {
                case CollectableEntityType.Health: CollectablesSubsystem.HealthCollectablesSpawned++; break;

                case CollectableEntityType.Gasoline: CollectablesSubsystem.GasolineCollectablesSpawned++; break;

                case CollectableEntityType.PistolAmmo: CollectablesSubsystem.PistolAmmoCollectablesSpawned++; break;

                case CollectableEntityType.ShotgunAmmo: CollectablesSubsystem.ShotgunAmmoCollectablesSpawned++; break;

                case CollectableEntityType.Energy: CollectablesSubsystem.EnergyCollectablesSpawned++; break;

                default: break;
                }
            }

            // Reset Zombie Subsystem
            ZombiesSubsystem.WaveTimer = saveStruct.WaveTimer;

            AchievmentsSubsystem.Initialize(saveStruct.Achievments);

            this.Results = new GameResults(saveStruct.Stats);

            this.GamePaused = true;
        }
Пример #4
0
 public static void LoadContent(ContentManager contentManager)
 {
     ZombieSprite.LoadContent(contentManager);
 }
 // TODO: Make private
 public void AddZombieSprite(ZombieSprite zombieSprite)
 {
     Game.SpritesDrawingManager.DrawableEntities.Add(zombieSprite);
     ZombiesUpdateManger.UpdatableEntities.Add(zombieSprite);
     ZombiesCollisionManager.CollidableEntities.Add(zombieSprite);
     ZombiesAttackManager.AttackableEntities.Add(zombieSprite);
     ZombieSprites.Add(zombieSprite);
 }
 private ZombieSprite CreateNewZombieSprite()
 {
     ZombieSprite zombieSprite = new ZombieSprite(this.Game, RandomZombieSpawnLocation(), 0, RandomHelper.NextRandomSingle());
     this.AddZombieSprite(zombieSprite);
     return zombieSprite;
 }
        private void StartPlayingSavedGame(GameSaveStruct saveStruct)
        {
            this.Options = new GameOptions(saveStruct.Options);
            this.StartPlayingGame();

            SurvivorSubsystem.AddPlayerOneSurvivorSprite(new SurvivorSprite(this, saveStruct.PlayerOneSurvivorSprite));
            foreach (ZombieSpriteSaveStruct zombieSpriteSaveStruct in saveStruct.ZombieSprites) {
                ZombieSprite zombieSprite = new ZombieSprite(this, zombieSpriteSaveStruct);
                ZombiesSubsystem.AddZombieSprite(zombieSprite);
            }

            foreach (CollectableSaveStruct collectableSaveStruct in saveStruct.Collectables) {
                CollectablesSubsystem.AddCollectable(new Collectable(this, collectableSaveStruct));
                switch (collectableSaveStruct.CollectableEntityType) {
                    case CollectableEntityType.Health: CollectablesSubsystem.HealthCollectablesSpawned++; break;
                    case CollectableEntityType.Gasoline: CollectablesSubsystem.GasolineCollectablesSpawned++; break;
                    case CollectableEntityType.PistolAmmo: CollectablesSubsystem.PistolAmmoCollectablesSpawned++; break;
                    case CollectableEntityType.ShotgunAmmo: CollectablesSubsystem.ShotgunAmmoCollectablesSpawned++; break;
                    case CollectableEntityType.Energy: CollectablesSubsystem.EnergyCollectablesSpawned++; break;
                    default: break;
                }
            }

            // Reset Zombie Subsystem
            ZombiesSubsystem.WaveTimer = saveStruct.WaveTimer;

            AchievmentsSubsystem.Initialize(saveStruct.Achievments);

            this.Results = new GameResults(saveStruct.Stats);

            this.GamePaused = true;
        }