Exemplo n.º 1
0
        public void UpdateComboEffects()
        {
            if (CurrentMusic.State == DynamicMusic.dynamicMusicState.PLAYING)
            {
                switch (player.ComboCount)
                {
                case 0:
                    if (isComboBreakerSoundPossible)
                    {
                        feedback_comboBreaker.Play();
                        feedbackLock = true;
                        isComboBreakerSoundPossible = false;
                    }
                    CurrentMusic.ResetSecondaryLayers();
                    Cutscenes.ZoomToStage(0);
                    break;

                case 3:
                    if (!feedbackLock)
                    {
                        feedback_combo3.Play();
                        Flash(0.5f);
                        feedbackLock = true;
                    }
                    CurrentMusic.EnableLayer(2);
                    Cutscenes.ZoomToStage(1);
                    break;

                case 6:
                    if (!feedbackLock)
                    {
                        feedback_combo6.Play();
                        Flash(0.5f);
                        feedbackLock = true;
                    }
                    CurrentMusic.EnableLayer(3);
                    Cutscenes.ZoomToStage(2);
                    break;

                case 9:
                    if (!feedbackLock)
                    {
                        feedback_combo9.Play();
                        Flash(0.5f);
                        feedbackLock = true;
                    }
                    CurrentMusic.EnableLayer(4);
                    isComboBreakerSoundPossible = true;
                    Cutscenes.ZoomToStage(3);
                    break;

                default:
                    feedbackLock = false;
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void ExecuteStartAction()
        {
            // Start challenges
            //
            if (choice == MenuState.CHALLENGE_CHOICE && canLauchChallenge)
            {
                HideMenu();
                Program.TheGame.LoadLevel((int)challengeChoice);
                //Game1.totem.BuildFromFile("Level1_p1");
                //Game1.scoreBorder.ScoreBarMaxValue = Game1.scoreBorder.calculateScoreMax();
                //Game1.mapBorder.setTopTotem();
                canLauchChallenge = false;
                Game1.SetupNextLevel();
                Cutscenes.GoToTotem(Game1.CurrentTotem, 0.5f, -40);
                Cutscenes.title.Dissappear();
                //Cutscenes.GoToTotem(Game1.CurrentTotem, 3.0f);
            }

            // Start random game
            //
            if (choice == MenuState.START)
            {
                HideMenu();
                Program.TheGame.LoadRandomLevel();
                Game1.SetupNextLevel();

                canLauchChallenge = false;
                //Game1.SetupNextLevel();
                Cutscenes.GoToTotem(Game1.CurrentTotem, 0.5f, -40);
                Cutscenes.title.Dissappear();
                //// Set informations for slides
                ////
                //Game1.scoreBorder.ScoreBarMaxValue = Game1.scoreBorder.calculateScoreMax();
                //Game1.mapBorder.setTopTotem();

                //Cutscenes.GoToTotem(Game1.totem);
            }

            if (choice == MenuState.CHALLENGES)
            {
                choice = MenuState.CHALLENGE_CHOICE;
                m_sprite.SpriteSheet     = TextureLibrary.GetSpriteSheet("menu_chall_bg");
                arrow.Transform.Position = new Vector2(-47, 7);
                canLauchChallenge        = true;
            }
        }
Exemplo n.º 3
0
        protected override void Update(GameTime gameTime)
        {
            old_kbs = kbs;
            kbs     = Keyboard.GetState();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || kbs.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            if (debugMode)
            {
                /*if (kbs.IsKeyDown(Keys.Left))
                 *      GameCamera.Transform.PosX -= 1f;
                 *      //Cutscenes.crowd.Transform.PosX -= 1.0f;
                 * if (kbs.IsKeyDown(Keys.Right))
                 *      //Cutscenes.crowd.Transform.PosX += 1.0f;
                 *      GameCamera.Transform.PosX += 1f;
                 * if (kbs.IsKeyDown(Keys.Up))
                 * GameCamera.Transform.PosY -= 1f;
                 * if (kbs.IsKeyDown(Keys.Down))
                 * GameCamera.Transform.PosY += 1;*/
                if (kbs.IsKeyDown(Keys.RightShift))
                {
                    GameCamera.Transform.ScaleUniform = GameCamera.Transform.SclX * 1.01f;
                }
                if (kbs.IsKeyDown(Keys.RightControl))
                {
                    GameCamera.Transform.ScaleUniform = GameCamera.Transform.SclX * 0.99f;
                }
            }

            startingCountdown.Update();

            menuScreen.Update();

            pauseScreen.Update();
            if (pauseScreen.IsGamePaused)
            {
                return;
            }

            // Update game if unpaused
            //
            player.Update();
            if (CurrentTotem != null)
            {
                CurrentTotem.Update();
                scoreBorder.Update();
                mapBorder.Update();
            }
            comboCounter.Update();

            GameCamera.Update();
            //if (GameCamera.Transform.PosY > -CameraOffset)
            //    GameCamera.Transform.PosY = -CameraOffset;

            Souls.Update();
            Cutscenes.Update();
            Explosions.Update();

            base.Update(gameTime);
        }
Exemplo n.º 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            TextureLibrary.LoadContent(Content, "Textures");
            TextureLibrary.Initialise(GraphicsDevice);
            Explosion.InitialiseIndexes();

            debugText = Content.Load <SpriteFont>("Text/Debug");
            menuText  = Content.Load <SpriteFont>("Text/Menu");

            SoundEffectLibrary.LoadContent(Content, "SoundEffects");

            m_drawer               = new GameboyDrawer(this);
            GameCamera             = new Camera2D(new Vector2(GameboyWidth * 0.5f, GameboyHeight * 0.5f));
            GameCamera.ScaleToZoom = true;

            // Totem
            //

            //LoadLevel(1);
            //totems[0] = new Totem();
            ////testTotem.BuildFromFile("Level1_p1");
            //totems[0].AddSections(new SectionData(typeof(NormalSection), 0, 0, 30));
            //totems[0].AddSections(new SectionData(typeof(MetalSection), 10, 10, 7));
            //totems[0].AddSections(new SectionData(typeof(SpikeSection), 4, 4, 7));
            //totems[0].BuildRandom();
            //totems[0].Transform.PosX = 100;


            // Player initialisation
            //
            player = new Player();

            // Pause screen & GUI initialisation
            //
            menuScreen        = new MenuScreen();
            pauseScreen       = new PauseScreen();
            startingCountdown = new Countdown();
            scoreBorder       = new ScoreBorder();
            mapBorder         = new MapBorder();
            comboCounter      = new ComboCounter(player);
            scoreDisplay      = new ScoreDisplay();

            // Background textures
            //
            m_falaise                = new Sprite(this, TextureLibrary.GetSpriteSheet("decors_sol_falaise"), new Transform());
            m_falaise.Origin         = new Vector2(0, 0.32f);
            m_falaise.Transform.PosX = -235;
            m_falaise.Transform.PosY = 8;

            // Sound & musics
            //
            normalTotemCollisionSound_Channel1        = SoundEffectLibrary.Get("normal_collision_sound").CreateInstance();
            normalTotemCollisionSound_Channel1.Volume = 0.6f;
            normalTotemCollisionSound_Channel2        = SoundEffectLibrary.Get("normal_collision_sound").CreateInstance();
            normalTotemCollisionSound_Channel2.Volume = 0.6f;
            metalTotemCollisionSound_Channel1         = SoundEffectLibrary.Get("metal_collision_sound").CreateInstance();
            metalTotemCollisionSound_Channel2         = SoundEffectLibrary.Get("metal_collision_sound").CreateInstance();

            swordSlashSound             = SoundEffectLibrary.Get("sword_slash").CreateInstance();
            moveLeftToRightSound        = SoundEffectLibrary.Get("move_left_to_right").CreateInstance();
            moveLeftToRightSound.Volume = 0.6f;
            moveRightToLeftSound        = SoundEffectLibrary.Get("move_right_to_left").CreateInstance();
            moveRightToLeftSound.Volume = 0.6f;
            spikeHitSound      = SoundEffectLibrary.Get("spike_hit").CreateInstance();
            groundImpact       = SoundEffectLibrary.Get("ground_slam").CreateInstance();
            footsteps          = SoundEffectLibrary.Get("footsteps").CreateInstance();
            footsteps.IsLooped = true;
            menuMusic          = SoundEffectLibrary.Get("music_menu").CreateInstance();
            successJingle      = SoundEffectLibrary.Get("success_jingle").CreateInstance();

            feedback_powerUp            = SoundEffectLibrary.Get("feedback_powerup").CreateInstance();
            feedback_combo3             = SoundEffectLibrary.Get("feedback_combo3").CreateInstance();
            feedback_combo3.Volume      = 0.2f;
            feedback_combo6             = SoundEffectLibrary.Get("feedback_combo6").CreateInstance();
            feedback_combo6.Volume      = 0.3f;
            feedback_combo9             = SoundEffectLibrary.Get("feedback_combo9").CreateInstance();
            feedback_combo9.Volume      = 0.4f;
            feedback_comboBreaker       = SoundEffectLibrary.Get("feedback_comboBreaker").CreateInstance();
            feedbackLock                = true;
            isComboBreakerSoundPossible = false;

            musicT4P1L1 = SoundEffectLibrary.Get("music_T4P1L1").CreateInstance();
            musicT4P1L2 = SoundEffectLibrary.Get("music_T4P1L2").CreateInstance();
            musicT4P1L3 = SoundEffectLibrary.Get("music_T4P1L3").CreateInstance();
            musicT4P1L4 = SoundEffectLibrary.Get("music_T4P1L4").CreateInstance();

            musicT4P2L1 = SoundEffectLibrary.Get("music_T4P2L1").CreateInstance();
            musicT4P2L2 = SoundEffectLibrary.Get("music_T4P2L2").CreateInstance();
            musicT4P2L3 = SoundEffectLibrary.Get("music_T4P2L3").CreateInstance();
            musicT4P2L4 = SoundEffectLibrary.Get("music_T4P2L4").CreateInstance();

            musicT4P3L1 = SoundEffectLibrary.Get("music_T4P3L1").CreateInstance();
            musicT4P3L2 = SoundEffectLibrary.Get("music_T4P3L2").CreateInstance();
            musicT4P3L3 = SoundEffectLibrary.Get("music_T4P3L3").CreateInstance();
            musicT4P3L4 = SoundEffectLibrary.Get("music_T4P3L4").CreateInstance();

            //dynamicMusic = new DynamicMusic(musicT1P1L1, musicT1P1L2, musicT1P1L3, musicT1P1L4);
            //dynamicMusic = new DynamicMusic(musicT1P2L1, musicT1P2L2, musicT1P2L3, musicT1P2L4);
            //dynamicMusic = new DynamicMusic(musicT4P2L1, musicT4P2L2, musicT4P2L3, musicT4P2L4);
            //dynamicMusic = new DynamicMusic(musicT4P3L1, musicT4P3L2, musicT4P3L3, musicT4P3L4);
            //Foule et joueur porté
            Cutscenes.Initalise();
            Cutscenes.Intro();
            SetupNextLevel();
        }
Exemplo n.º 5
0
        public static void Initalise()
        {
            cutscenePlayer = new CutscenePlayer();
            cutscenePlayer.Transform.PosX = -100;
            monster = new Monster();
            crowd   = new Crowd(40, 18, new Vector2(2.5f, 0.5f));

            title = new Title();

            DelayAction cameraDelay = new DelayAction(Program.TheGame, CameraDelay);

            moveToTotem = new MoveToStaticAction(Program.TheGame, Game1.GameCamera.Transform, Vector2.Zero, 1);
            moveToTotem.StartPosition  = new Vector2(CameraMenuX, CameraMenuY);
            moveToTotem.Interpolator   = new PSmoothstepInterpolation();
            moveToTotem.Timer.Interval = TimeToFirstTotem;
            MethodAction moveCrowd = new MethodAction(delegate() {
                crowd.MoveTo(currentTotemPosition + TotemCrowdOffset, TimeToFirstTotem);
            });

            gotoFirstTotem = new Sequence(1);
            gotoFirstTotem.AddAction(cameraDelay);
            gotoFirstTotem.AddAction(moveCrowd);
            gotoFirstTotem.AddAction(moveToTotem);
            gotoFirstTotem.AddAction(new MethodAction(delegate() { Cutscenes.ThrowPlayer(Game1.CurrentTotem); }));

            playerLaunch = new Sequence(1);
            playerLaunch.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            moveToAscendingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1);
            moveToAscendingPlayer.Interpolator   = new PSquareInterpolation(0.1f);
            moveToAscendingPlayer.RotationActive = false;
            playerLaunch.AddAction(moveToAscendingPlayer);

            readySequence = new Sequence(1);
            Transform end = new Transform(Game1.player.Transform, true);

            end.PosY            = Game1.CameraOffset;
            moveToFallingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), end, 1);
            moveToFallingPlayer.Interpolator   = new PSmoothstepInterpolation();
            moveToFallingPlayer.RotationActive = false;

            readySequence.AddAction(new MethodAction(delegate() { Game1.player.GetReady(); }));
            readySequence.AddAction(moveToFallingPlayer);
            readySequence.AddAction(new MethodAction(delegate() { Game1.player.StartCountDown(); }));

            cameraZoom = new ScaleToAction(Program.TheGame, Game1.GameCamera.Transform, Vector2.Zero, 1);
            cameraZoom.Interpolator   = new PSmoothstepInterpolation();
            cameraZoom.Timer.Interval = 0.3f;

            goToPlayerOnGround         = new Sequence(1);
            goToPlayerOnGroundMovement = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1);
            goToPlayerOnGroundMovement.Timer.Interval = 1.0f;
            goToPlayerOnGroundMovement.Interpolator   = new PSmoothstepInterpolation();
            goToPlayerOnGround.AddAction(new DelayAction(Program.TheGame, 0.5f));
            goToPlayerOnGround.AddAction(goToPlayerOnGroundMovement);

            intro = new Sequence(1);
            MoveToStaticAction moveToMenu = new MoveToStaticAction(Program.TheGame, Game1.GameCamera.Transform, new Vector2(CameraMenuX, CameraMenuY), 1);

            moveToMenu.Timer.Interval = MoveInTime + 1.0f;

            intro.AddAction(moveToMenu);
            intro.AddAction(new MethodAction(delegate() { crowd.PushNewGuy(); }));
            intro.AddAction(new DelayAction(Program.TheGame, 1.5f));
            intro.AddAction(new MethodAction(delegate() { StartMainMenu(); }));

            goToCliff = new Sequence(1);
            goToCliff.AddAction(moveToTotem);
            goToCliff.AddAction(new MethodAction(delegate() { cutscenePlayer.GiveSouls(Game1.TotalScore); monster.OpenMouth(); }));

            auraTexture = TextureLibrary.GetSpriteSheet("soul_temp");
            soulTexture = TextureLibrary.GetSpriteSheet("soul");
            //moveToAscendingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1);
        }
Exemplo n.º 6
0
        public CutscenePlayer()
            : base()
        {
            m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance();
            m_cloud       = new Prop("cloud");
            m_sword       = new Prop("sword");

            m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true));

            m_sprite                 = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true));
            m_sprite.Origin          = new Vector2(0.5f, 0.5f);
            m_sprite.PixelCorrection = false;

            m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1);
            m_moveToCrowd.Timer.Interval = 0.1f;
            MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1);

            carryMovement.Interpolator   = new PBounceInterpolation(1.0f);
            carryMovement.StartPosition  = new Vector2(0, CarryHeight);
            carryMovement.Timer.Interval = 0.2f;
            MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); });

            Sequence bounceAnimation = new Sequence(-1);

            bounceAnimation.AddAction(carryMovement);
            bounceAnimation.AddAction(action);

            m_carryAnimation = new Sequence(1);
            m_carryAnimation.AddAction(m_moveToCrowd);
            m_carryAnimation.AddAction(bounceAnimation);


            //Sword movement
            Transform start = new Transform(m_transform, true);
            Transform end   = new Transform(m_transform, true);

            m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1);
            end.PosX        = SwordOffsetToPlayerX;
            end.PosY        = SwordOffsetToPlayerY;
            m_swordDelay    = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio);

            //Cloud movement
            m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1);
            m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0);
            m_cloudMovement.Interpolator  = new PSquareInterpolation(0.25f);

            //Delay of the ascend, then sword/cloud movement
            Sequence swordAndCloudMovement = new Sequence(1);

            swordAndCloudMovement.AddAction(m_swordDelay);
            swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement }));

            m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1);
            m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f);

            MethodAction showPlayer = new MethodAction(delegate()
            {
                m_sprite.Transform.PosY -= 1;
                Game1.player.ShowPlayer();
                isVisible         = false;
                m_cloud.IsVisible = false;
                m_sword.IsVisible = false;
            });

            //Shling!
            ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1);

            shlingScale.Timer.Interval = ShlingTime;
            shlingScale.StartScale     = Vector2.Zero;
            shlingScale.Interpolator   = new PSquareInterpolation(2);

            RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1);

            shlingRotate.Timer.Interval = ShlingTime;
            m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate });

            Sequence readyAnim = new Sequence(1);

            readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f));
            readyAnim.AddAction(new MethodAction(delegate() {
                Cutscenes.GetReady();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));

            Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] {
                m_shling,
                readyAnim,
            });

            m_ascend = new Sequence(1);
            m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); }));
            Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement });

            m_ascend.AddAction(ascendAndSword);
            m_ascend.AddAction(showPlayer);
            m_ascend.AddAction(shlingReady);

            m_physics      = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 3.0f;

            m_jumpFromTotem           = new Sequence(1);
            m_decelerate              = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1);
            m_decelerate.Interpolator = new PSquareInterpolation(0.5f);
            m_jumpFromTotem.AddAction(m_decelerate);
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                m_physics.OnBounce = null;
                m_physics.Throw(1.0f, -2.0f, 0);
                Game1.CurrentMusic.StopDynamicMusic();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                Game1.SetupNextRound();
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
            }));
            m_actionManager = new SingleActionManager();

            m_hitSpikes = new Sequence(1);

            m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1);
            m_moveToCrashingPlayer.Timer.Interval = 0.2f;

            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_hitSpikes.AddAction(m_moveToCrashingPlayer);
            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_hitSpikes.AddAction(new MethodAction(delegate() {
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
                m_sprite.SetFrame(0);
                m_physics.OnBounce = null;
                m_physics.Throw(0, -3, 0);
                m_transform.PosY = m_physics.GroundLevel;
            }));

            m_auraParticles = new ParticleSystem(Program.TheGame, 100);
            m_soulParticles = new ParticleSystem(Program.TheGame, 500);

            m_levitate       = new Sequence(1);
            m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1);
            m_moveToCliffTip.Interpolator   = new PSmoothstepInterpolation();
            m_moveToCliffTip.Timer.Interval = 1.0f;
            m_levitate.AddAction(m_moveToCliffTip);
            m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; }));

            m_particleGenerator                    = new ParticleGenerator <GlitterParticle>(Program.TheGame, m_auraParticles);
            m_particleGenerator.Automatic          = true;
            m_particleGenerator.GenerationInterval = 0.01f;
            m_soulParticleGenerator                = new ParticleGenerator <SoulParticle>(Program.TheGame, m_soulParticles);

            m_jumpInMouth = new Sequence(1);
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); }));
        }
Exemplo n.º 7
0
        public override void Update()
        {
            bool animationIsActive = m_slashLR.IsActive || m_slashRL.IsActive ||
                                     m_slashBounceLR.IsActive || m_slashBounceLR.IsActive ||
                                     m_metalBounceLR.IsActive || m_metalBounceRL.IsActive;


            // Introduction animation (walking to totem)
            //
            //if (Game1.kbs.IsKeyDown(Keys.S) && Game1.old_kbs.IsKeyUp(Keys.S))
            //{
            //    m_actionManager.StartNew(m_walkingToTotem);
            //}

            // TODO
            // faire un compteur
            // 1 - le perso décolle
            // 2 - Il arrive à l'arc de son vol et commence à redescendre. => le décompte commence
            // 3 - Vers la fin du compteur, les slides apparaissent
            // 4 - Fin du compteur, le joueur atteint le top du totem et le joueur a le controle
            //

            // Unlock commands if falling and countdownFinished are true
            //
            if (isFalling)
            {
                if (Game1.startingCountdown.CountdownHasFinished)
                {
                    if (Game1.kbs.IsKeyDown(Keys.LeftAlt) && Game1.old_kbs.IsKeyUp(Keys.LeftAlt) && !animationIsActive)
                    {
                        Game1.swordSlashSound.Play();

                        if (isToLeft)
                        {
                            m_actionManager.StartNew(m_slashBounceLR);
                            m_spriteAnimation.StartNew(m_spritAnimLL);
                            //m_spritAnimLL.Timer.Interval =
                            isToLeft = true;
                        }
                        else
                        {
                            m_actionManager.StartNew(m_slashBounceRL);
                            m_spriteAnimation.StartNew(m_spritAnimRR);
                            isToLeft = false;
                        }
                    }

                    if (Game1.kbs.IsKeyDown(Keys.Space) && Game1.old_kbs.IsKeyUp(Keys.Space) && !animationIsActive)
                    {
                        Game1.swordSlashSound.Play();

                        if (isToLeft)
                        {
                            Game1.moveLeftToRightSound.Play();
                            m_actionManager.StartNew(m_slashLR);
                            m_spriteAnimation.StartNew(m_spritAnimLR);
                            isToLeft = false;
                            Game1.comboCounter.RestartScrolling();
                        }
                        else
                        {
                            Game1.moveRightToLeftSound.Play();
                            m_actionManager.StartNew(m_slashRL);
                            m_spriteAnimation.StartNew(m_spritAnimRL);
                            isToLeft = true;
                            Game1.comboCounter.RestartScrolling();
                        }
                    }

                    if (isPoweredUp)
                    {
                        if (isToLeft)
                        {
                            m_spriteAura.Transform.PosX = -4;
                        }
                        else
                        {
                            m_spriteAura.Transform.PosX = 4;
                        }

                        m_spriteAura.Transform.Scale      = new Vector2(1);
                        m_spriteAura.Transform.Direction += speedRotation;
                    }
                    else
                    {
                        m_spriteAura.Transform.Scale     = new Vector2(0);
                        m_spriteAura.Transform.Direction = 0;
                    }

                    if (!animationIsActive)
                    {
                        if (isToLeft)
                        {
                            m_sprite.SetFrame(4);
                        }
                        else
                        {
                            m_sprite.SetFrame(12);
                        }
                    }
                }


                // Update falling
                //
                this.Transform.PosY = this.Transform.PosY + (float)(BasePlayerSpeed * SpeedMultiplier * Program.TheGame.ElapsedTime);

                if (Transform.PosY > m_totemInstance.Base)
                {
                    Cutscenes.FinishTotem();
                }
            }

            m_actionManager.Update();
            m_spriteAnimation.Update();
            Game1.old_kbs = Game1.kbs;
        }