示例#1
0
    protected override void Initialize()
    {
      base.Initialize();

      App.Instance = this;
      //Initialize the game model
      gameModel = new GameModel();
      //Initialize AudioEngine
      towerAudioEngine = new TowerAudioEngine(gameModel);
      //Initialize the UI component
      gameView = new SimpleView(gameModel, graphics, Content);
      contactParser = new ContactParser();
    }
        public EffectPlayer(AudioEngine audioEngine, TowerAudioEngine tae)
        {
            this.towerAudioEngine = tae;
            this.audioEngine = audioEngine;

            soundBank = new SoundBank(audioEngine, "Content/Effect Sound.xsb");

            App.Instance.Model.AddPlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnAddPlayer);
            App.Instance.Model.RemovePlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnRemovePlayer);
            App.Instance.Model.NewEnemy += new EventHandler<SurfaceTower.Model.EventArguments.EnemyArgs>(OnNewEnemy);
            App.Instance.Model.Tower.ZeroHealth += new EventHandler(Tower_ZeroHealth);

            heartbeatCue = soundBank.GetCue("Hearbeat");
            introCue = soundBank.GetCue("Intro");
            introCue.Play();
            firstPlayerHasJoined = false;
        }