public void ActivateTriggerWithCS()
        {
            Level level = GameManager.Levels[GameManager.CurrentLevel];

            level.LevelState = LevelState.CutScene;
            level.Player1.ResetIdleGraphic();

            level.CutScenes[level.CurrentCutScene].PlayFirstLine();
            MusicManager.ChangeToVolume(MusicManager.VolumeTarget);
        }
Пример #2
0
        public void ActivateSceneEvent()
        {
            SceneEvents[CurrentSceneEvent].Activate(this);

            // Next Scene Event to happen next time
            CurrentSceneEvent++;

            this.LevelState = LevelState.Playing;
            MusicManager.ChangeToVolume(MusicManager.CurrentVolume);
        }
Пример #3
0
        public void Update(GameTime gT)
        {
            switch (this.LevelState)
            {
                #region Intro

            case LevelState.Intro:
                Player1.Update(gT);

                break;
                #endregion

                #region Cutscene

            case LevelState.CutScene:
                CutScenes[CurrentCutScene].PlayScene(gT);
                break;

                #endregion

                #region Playing
            case LevelState.Playing:
                // Update the Actors
                for (int i = 0; i < Actors.Count; i++)
                {
                    Actors[i].Update(gT);
                }

                // Update Game Items
                for (int i = 0; i < GameItems.Count; i++)
                {
                    GameItems[i].Update(gT);
                }

                // Update Enemy Spawners
                for (int i = 0; i < EnemySpawners.Count; i++)
                {
                    EnemySpawners[i].Update(gT);
                }

                // Update Camera Position
                UpdateCameraPosition(gT);

                // Update Trigger
                this.CurrentTrigger.Update();

                // Extend the play area?
                if (InputHelper.WasKeyPressed(Keys.Q))
                {
                    AddToPlayBounds(150);
                }

                break;
                #endregion

                #region Continue

            case LevelState.Continue:
                TimerContinue -= (float)gT.ElapsedGameTime.TotalSeconds;
                // TimerContinue Finished
                if (TimerContinue <= 0)
                {
                    // Out of time, Game Over
                    this.LevelState = LevelState.GameOver;
                }

                //
                if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.A) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.B) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.X) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Y) ||
                    InputHelper.WasKeyPressed(Keys.NumPad7) ||
                    InputHelper.WasKeyPressed(Keys.NumPad8))
                {
                    this.TimerContinue--;
                    SoundManager.PlaySound("PickUpItem");
                }

                // Has player pressed Start to continue
                //if (InputHelper.WasKeyPressed(Keys.Space))
                if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Start) ||
                    InputHelper.WasKeyPressed(Keys.Enter) ||
                    InputHelper.WasKeyPressed(Keys.Space))
                {
                    SoundManager.PlaySound("CrashGlass");
                    SoundManager.PlaySound("CodyWins");
                    this.Player1.Continue();
                    this.LevelState = LevelState.Playing;
                }
                break;

                #endregion

                #region GameOver

            case LevelState.GameOver:
                // Has player pressed Start to continue
                //if (InputHelper.WasKeyPressed(Keys.Space))
                if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Start) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.A) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.B) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.X) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Y) ||
                    InputHelper.WasKeyPressed(Keys.Space) ||
                    InputHelper.WasKeyPressed(Keys.Enter))
                {
                    SoundManager.PlaySound("CrashGlass");
                    SoundManager.PlaySound("CodyWins");
                    GameManager.GameState = GameState.MainMenu;
                }

                break;

                #endregion

                #region Completed Game
            case LevelState.Completed:

                if (InputHelper.WasKeyPressed(Keys.Space) ||
                    InputHelper.WasKeyPressed(Keys.Enter) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.A) ||
                    InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Start))
                {
                    GameManager.GameState = GameState.MainMenu;
                    MusicManager.PlaySong(Game1.MusicTitleScreen);
                    SoundManager.PlaySound("CrashGlass");
                    SoundManager.PlaySound("GetOutOfMyFace");
                    MusicManager.ChangeToVolume(MusicManager.CurrentVolume);
                }


                break;

                #endregion

                #region FadeIn
            case LevelState.FadeIn:
                HUDManager.Opacity -= 0.008f;
                if (HUDManager.Opacity <= 0)
                {
                    HUDManager.Opacity = 0;
                    LevelState         = LevelState.Intro;
                }
                break;


                #endregion

                #region FadeOut
            case LevelState.FadeOut:

                HUDManager.Opacity += 0.008f;
                if (HUDManager.Opacity >= 1f)
                {
                    HUDManager.Opacity = 1;
                    GameManager.GoToNextLevel();
                }
                break;



                #endregion
            }
        }
 public void PlayFirstLine()
 {
     currentTime = timers[0];
     //SoundManager.PlayVoiceSound(voiceActing[0]);
     MusicManager.ChangeToVolume(MusicManager.VolumeTarget);
 }