Esempio n. 1
0
 public override void Update(GameTime gameTime)
 {
     m_elf.Update(gameTime, Player);
     if (!RoomCompleted)
     {
         if (m_paid)
         {
             if (!IsReversed && Player.X < X + 50f)
             {
                 Player.X = X + 50f;
             }
             else if (IsReversed && Player.X > X + Width - 50f)
             {
                 Player.X = X + Width - 50f;
             }
         }
         if (NumberOfChestsOpen >= 1)
         {
             var flag = false;
             foreach (var current in m_chestList)
             {
                 if (current.IsEmpty && current.IsOpen)
                 {
                     flag = true;
                 }
                 current.IsLocked = true;
             }
             RoomCompleted = true;
             var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
             if (!flag)
             {
                 rCScreenManager.DialogueScreen.SetDialogue("ChestBonusRoom1-Won");
             }
             else
             {
                 rCScreenManager.DialogueScreen.SetDialogue("ChestBonusRoom1-Lost");
             }
             Game.ScreenManager.DisplayScreen(13, true);
         }
     }
     HandleInput();
     base.Update(gameTime);
 }
Esempio n. 2
0
        public override void Update(GameTime gameTime)
        {
            m_elf.Update(gameTime, Player);
            if (!IsReversed)
            {
                if (Player.X >= m_line.X - 150f)
                {
                    Player.X = (int)m_line.X - 150;
                }
            }
            else if (Player.X < m_line.X + 150f)
            {
                Player.X = m_line.X + 150f;
            }
            if (!IsReversed)
            {
                if (m_isPlayingGame && Player.X < Player.AttachedLevel.Camera.Bounds.Left)
                {
                    Player.X = Player.AttachedLevel.Camera.Bounds.Left;
                }
                if (Player.X > Bounds.Right - 1320)
                {
                    Player.X = Bounds.Right - 1320;
                }
            }
            else
            {
                if (m_isPlayingGame && Player.X > Player.AttachedLevel.Camera.Bounds.Right)
                {
                    Player.X = Player.AttachedLevel.Camera.Bounds.Right;
                }
                if (Player.X < Bounds.Left + 1320)
                {
                    Player.X = Bounds.Left + 1320;
                }
            }
            if (m_currentTarget != null && !m_currentTarget.Broken)
            {
                var num = (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (m_targetMovingUp && m_currentTarget.Bounds.Top > Bounds.Top + 80)
                {
                    m_currentTarget.Y -= num * m_targetSpeed;
                }
                else if (m_targetMovingUp)
                {
                    m_currentTarget.Y += num * m_targetSpeed;
                    m_targetMovingUp   = false;
                }
                if (!m_targetMovingUp && m_currentTarget.Bounds.Bottom < Bounds.Bottom - 140)
                {
                    m_currentTarget.Y += num * m_targetSpeed;
                }
                else if (!m_targetMovingUp)
                {
                    m_currentTarget.Y -= num * m_targetSpeed;
                    m_targetMovingUp   = true;
                }
            }
            if (m_isPlayingGame &&
                ((m_daggersThrown >= m_numTries && Player.AttachedLevel.ProjectileManager.ActiveProjectiles < 1 &&
                  ActiveTargets > 0) || ActiveTargets <= 0))
            {
                EndGame();
            }
            if (m_currentTarget != null && m_currentTarget.Broken && ActiveTargets >= 0)
            {
                m_currentTargetIndex++;
                ActivateTarget();
            }
            if (m_elf.IsTouching && !RoomCompleted && !m_spokeToNPC)
            {
                if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
                {
                    var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                    rCScreenManager.DialogueScreen.SetDialogue("CarnivalRoom1-Start");
                    rCScreenManager.DialogueScreen.SetDialogueChoice("ConfirmTest1");
                    rCScreenManager.DialogueScreen.SetConfirmEndHandler(this, "BeginGame");
                    rCScreenManager.DialogueScreen.SetCancelEndHandler(typeof(Console), "WriteLine",
                                                                       "Canceling Selection");
                    (Player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(13, true);
                }
            }
            else if (m_elf.IsTouching && RoomCompleted &&
                     (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)))
            {
                var rCScreenManager2 = Player.AttachedLevel.ScreenManager as RCScreenManager;
                rCScreenManager2.DialogueScreen.SetDialogue("CarnivalRoom1-End");
                (Player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(13, true);
            }
            if (m_isPlayingGame)
            {
                m_elf.CanTalk = false;
            }
            else
            {
                m_elf.CanTalk = true;
            }
            var totalGameTime = Game.TotalGameTime;
            var num2          = 2f;

            foreach (var current in m_balloonList)
            {
                current.Rotation = (float)Math.Sin(totalGameTime * num2) * num2;
                num2            += 0.2f;
            }
            HandleInput();
            base.Update(gameTime);
        }
Esempio n. 3
0
        public override void Update(GameTime gameTime)
        {
            if ((m_axesThrown >= m_numTries && m_isPlayingGame &&
                 Player.AttachedLevel.ProjectileManager.ActiveProjectiles < 1) ||
                (m_isPlayingGame && TargetsDestroyed >= 100))
            {
                EndGame();
            }
            if (m_isPlayingGame && !m_gateClosed &&
                ((!IsReversed && Player.X > m_gate.Bounds.Right) || (IsReversed && Player.X < m_gate.Bounds.Left)))
            {
                Player.LockControls();
                Player.CurrentSpeed  = 0f;
                Player.AccelerationX = 0f;
                Tween.By(m_gate, 0.5f, Quad.EaseInOut, "Y", m_gate.Height.ToString());
                Tween.AddEndHandlerToLastTween(Player, "UnlockControls");
                m_gateClosed = true;
                Player.AttachedLevel.CameraLockedToPlayer = false;
                if (!IsReversed)
                {
                    Tween.To(Player.AttachedLevel.Camera, 1f, Quad.EaseInOut, "X",
                             (Bounds.Right - Player.AttachedLevel.Camera.Width / 2f).ToString());
                }
                else
                {
                    Tween.To(Player.AttachedLevel.Camera, 1f, Quad.EaseInOut, "X",
                             (Bounds.Left + Player.AttachedLevel.Camera.Width / 2f).ToString());
                }
            }
            m_elf.Update(gameTime, Player);
            if (m_isPlayingGame)
            {
                m_elf.CanTalk = false;
            }
            else
            {
                m_elf.CanTalk = true;
            }
            if (m_elf.IsTouching && !RoomCompleted && !m_isPlayingGame)
            {
                if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
                {
                    var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                    rCScreenManager.DialogueScreen.SetDialogue("CarnivalRoom2-Start");
                    rCScreenManager.DialogueScreen.SetDialogueChoice("ConfirmTest1");
                    rCScreenManager.DialogueScreen.SetConfirmEndHandler(this, "BeginGame");
                    rCScreenManager.DialogueScreen.SetCancelEndHandler(typeof(Console), "WriteLine",
                                                                       "Canceling Selection");
                    (Player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(13, true);
                }
            }
            else if (m_elf.IsTouching && RoomCompleted &&
                     (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)))
            {
                var rCScreenManager2 = Player.AttachedLevel.ScreenManager as RCScreenManager;
                rCScreenManager2.DialogueScreen.SetDialogue("CarnivalRoom1-End");
                (Player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(13, true);
            }
            if (!IsReversed && m_isPlayingGame && Player.X < Bounds.Left + 10)
            {
                Player.X = Bounds.Left + 10;
            }
            else if (IsReversed && m_isPlayingGame && Player.X > Bounds.Right - 10)
            {
                Player.X = Bounds.Right - 10;
            }
            var totalGameTime = Game.TotalGameTime;
            var num           = 2f;

            foreach (var current in m_balloonList)
            {
                current.Rotation = (float)Math.Sin(totalGameTime * num) * num;
                num += 0.2f;
            }
            HandleInput();
            base.Update(gameTime);
        }