Beispiel #1
0
        public LoadingState(LoadContentFunction loadFunction, 
            GraphicsDevice graphicsDevice, 
            SpriteBatch spriteBatch, 
            SpriteFont UIFont)
        {
            _graphicsDevice = graphicsDevice;
            _spriteBatch = spriteBatch;

            _loadingComplete = false;
            _loadFunction = loadFunction;
            _animatedMessage = _loadingTextBase;
            _loadStateReporter = new LoadStateReporter();

            _loadingMessageDimensions = FontManager.Instance.BangersLarge.MeasureString(_animatedMessage);
            _loadingMessagePosition = new Vector2(
                    (_graphicsDevice.Viewport.Width - _loadingMessageDimensions.X) / 2,
                    (_graphicsDevice.Viewport.Height - _loadingMessageDimensions.Y) / 2);

            ThreadHelper.RunAsync(LoadContentMain);
        }
Beispiel #2
0
 public void LoadAudio(LoadStateReporter loadStateReporter)
 {
     loadStateReporter.CurrentStatus = "Loading Audio";
     SoundManager.Instance.LoadAudio();
 }
Beispiel #3
0
        /// <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;
        }