Ejemplo n.º 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();
    }
Ejemplo n.º 2
0
    public TestingApp()
    {
      App.Instance = this;
      
      PresentationParameters pp = new PresentationParameters();
      graphics = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.NullReference, System.IntPtr.Zero, pp);

      model = new GameModel();
      model.Music.TimeSignature = new TimeSignature(4, 4);
      model.Music.Tempo = 60;
      model.Music.ClicksPerBeat = 4;

      controller = new ContactParser();
    }
Ejemplo n.º 3
0
        public MelodyPlayer(AudioEngine audioEngine)
        {
            this.audioEngine = audioEngine;
            model = App.Instance.Model;

            soundBanks = new LinkedList<SoundBank>();

            soundBanks.Add(new SoundBank(audioEngine, "Content/Eva Sound.xsb"));
            soundBanks.Add(new SoundBank(audioEngine, "Content/Simpleb Sound.xsb"));
            soundBanks.Add(new SoundBank(audioEngine, "Content/Spaceb Sound.xsb"));
            soundBanks.Add(new SoundBank(audioEngine, "Content/Weeping Sound.xsb"));

            scaleDecider = new ScaleDecider(Note.C, ScaleDecider.ScaleType.Major);

            currentNotePosition = (int)ScaleDegree.Tonic1;
            previousNotePosition = (int)ScaleDegree.Tonic1;
            previousCues = new Cue[3];
            random = new Random();
        }
Ejemplo n.º 4
0
 public SimpleView(BaseModel baseModel, GraphicsDeviceManager graphics, ContentManager content)
 {
     this.baseModel = baseModel;
     this.graphics = graphics;
     this.gm = (App) App.Instance;
     this.content = content;
     //initializes the sprite batch
     spritebatch = new SpriteBatch(graphics.GraphicsDevice);
     //Loads the sprites
     enemy = content.Load<Texture2D>("Drone");
     bulletNorm = content.Load<Texture2D>("bullet");
     bulletDisc = content.Load<Texture2D>("discbullet");
     bulletWide = content.Load<Texture2D>("widebullet");
     middle = content.Load<Texture2D>("centre");
     try
     {
       middle0 = content.Load<Texture2D>("tower-0");
       middle1 = content.Load<Texture2D>("tower-1");
       middle2 = content.Load<Texture2D>("tower-2");
     }
     catch (Exception)
     {
       simpleMid = true;
     }
     gun1 = content.Load<Texture2D>("turret");
     gun2 = content.Load<Texture2D>("2turret");
     gun3 = content.Load<Texture2D>("3turret");
     boss = content.Load<Texture2D>("spaceinvader");
     background = content.Load<Texture2D>("bg1");
     graphics.GraphicsDevice.Clear(Color.Black);
     //Initializes the bloom postprocessing with the device to display on
     bloom = new BloomPostprocess.BloomComponent(gm, graphics.GraphicsDevice);
     //Registers the bloom compenent to the list of compenents, it will be drawn AFTER the rest of the game.
     gm.Components.Add(bloom);
     particleEngine = new PEngine(this);
     menuManager = new MenuDrawers.MenuManager();
     baseModel.Tower.ZeroHealth += new EventHandler(OnDeath);
 }
        public TowerAudioEngine(BaseModel baseModel)
        {
          try
          {
            this.baseModel = baseModel;

            audioEngine = new AudioEngine("Content/8bit.xgs");
            audioEngine.Update();

            //setting the values in App.Instance.Music
            App.Instance.Model.Music.TimeSignature = new TimeSignature(4, 4);
            App.Instance.Model.Music.Tempo = 60;
            App.Instance.Model.Music.ClicksPerBeat = 4;

            //this is needed as the constructor does something magical which allows the sounds to play
            waveBanks = new LinkedList<WaveBank>();
            waveBanks.Add(new WaveBank(audioEngine, "Content/Drum Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Effect Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Eva Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Simpleb Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Spaceb Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Weeping Bank.xwb"));

            drumPlayer = new DrumPlayer(audioEngine);
            melodyPlayer = new MelodyPlayer(audioEngine);
            effectPlayer = new EffectPlayer(audioEngine, this);

            App.Instance.Model.Music.Click += new EventHandler(OnClick);
            App.Instance.Model.Music.Beat += new EventHandler(OnBeat);
            App.Instance.Model.Music.Bar += new EventHandler(OnBar);
            App.Instance.Model.Update += new EventHandler<SurfaceTower.Model.EventArguments.UpdateArgs>(OnUpdate);
          }
          catch (InvalidOperationException)
          {
            Console.WriteLine("There is no audio device plugged in. AudioEngine will not be used.");
          }
        }