Exemple #1
0
 public SummaryState(CongaLine line, ScoreComponent score)
 {
     _line = line;
     _score = score;
 }
        /// <summary>
        /// Loads all the content for this State.
        /// You should show a loading screen here, it may take a while.
        /// </summary>
        public void LoadContent(LoadStateReporter loadStateReporter)
        {
            _isLoaded = false;
            loadStateReporter.CurrentStatus = "Loading Models";
            BatchedModelManager.Instance.LoadContent(_contentManager, _graphicsDevice);
            BatchedModelManager.Instance.ClearInstances();

            loadStateReporter.CurrentStatus = "Loading Animation";
            AnimationManager.Instance.LoadContent();

            loadStateReporter.CurrentStatus = "Creating CongaLine";

            PerspectiveCamera camera = new PerspectiveCamera(_graphicsDevice);

            Dancer leader = DancerFactory.Instance.GetRandomDancer();
            leader.SetDancerBehavior(new LeadDancerBehavior(leader));
            _congaLine = new CongaLine(leader, camera);

            _cameraController = new CameraController(camera);
            _cameraController.SetCameraBehavior(new BehindViewBehavior(camera, _congaLine.LeadDancer));

            _accelerometer.Start();

            loadStateReporter.CurrentStatus = "Requesting DJ to play a song";
            _music = SoundManager.Instance.GetRandomSong();
            _loseSound = SoundManager.Instance.GetRecordScratchInstance();
            _winSound = SoundManager.Instance.GetApplauseSoundEffect();

            _mainHud = new MainGameHud(_graphicsDevice, _spriteBatch, FontManager.Instance.BangersMedium);

            loadStateReporter.CurrentStatus = "Loading DanceRoom";
            _danceFloor = _contentManager.Load<Model>("Models\\DanceRoom");
            _drinkEmitter.LoadContent();

            //Instance our first Render Target to the same size as the back buffer.
            currentFrame = new RenderTarget2D(_graphicsDevice,
                _graphicsDevice.PresentationParameters.BackBufferWidth ,
                _graphicsDevice.PresentationParameters.BackBufferHeight,
                false,
                _graphicsDevice.DisplayMode.Format,
                DepthFormat.Depth24);

            drunkFrame = new RenderTarget2D(_graphicsDevice,
                currentFrame.Width / 4,
                currentFrame.Height / 4,
                false,
                _graphicsDevice.DisplayMode.Format,
                DepthFormat.None);

            _score = new ScoreComponent();

            GC.Collect();
            _isLoaded = true;
            _beginGame = true;
        }