Example #1
0
        private void UpdateFade(GameTime gameTime)
        {
            fadeTimePassed += (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (fadeTimePassed >= fadeTimeTotal)
            {
                fading = false;

                if (Engine.NextState != null)
                {
                    //if (NextState == States[(int)StateType.Title])
                        //ResetGame ();

                    // Go to the next level
                    if (Engine.NextLevelIndex != Engine.Project.levelIndex)
                        Engine.Project.levelIndex = Engine.NextLevelIndex;

                    Engine.NextState.Activate();
                    Engine.Project.CurrentState = Engine.NextState;
                    Engine.NextState = null;

                    Fade (0, 255, 0.75f);
                    //EngineRef.music.PlayMusic ("Song1");
                    //EngineRef.music.FadeIn (1.5f);
                }

                if (fadeAction != null)
                    fadeAction();

                // Super hack
                if (displayTeam)
                {
                    fading = true;
                }

            }
        }
Example #2
0
 public void SetState(string name)
 {
     this.CurrentState = states[name];
     this.CurrentState.Activate();
 }
Example #3
0
        protected override void LoadContent()
        {
            Engine.Batch = spriteBatch = new SpriteBatch(GraphicsDevice);

            levels = new BaseLevel[]
            {
                new LevelIntro(),
                new LevelOne(),
                new LevelTwo(),
                new LevelThree(),
                new LevelOutro(),
            };
            levelIndex = 0;

            states = new Dictionary<string, BaseState>
            {
                {"MenuState", new MenuState()},
                {"GameState", new GameState()}
            };

            foreach (BaseState state in states.Values)
                state.Load();

            team = Content.Load<Texture2D> ("Team");
            teamLocation = new Vector2((ScreenWidth / 2) - (team.Width / 2),
                (ScreenHeight/ 2) - (team.Height / 2));

            black = new Texture2D (graphics.GraphicsDevice, 1, 1);
            black.SetData (new [] { Color.Black});

            BlankTexture = new Texture2D (graphics.GraphicsDevice, 1, 1);
            BlankTexture.SetData (new [] { Color.White});;

            this.CurrentState = states["MenuState"];
            this.CurrentState.Activate();

            Fade (0f, 255f, 0.50f);
        }
Example #4
0
        public void NextLevel()
        {
            NextLevelIndex = levelIndex + 1;
            NextState = states["GameState"];
            Fade (255, 0, 0.75f);

            //music.FadeOut (0.75f);
        }