コード例 #1
0
 public override void Update(GameTime gameTime)
 {
     m_icon.Y         = m_iconYPos + (float)Math.Sin(Game.TotalGameTime * 2f) * 5f;
     m_speechBubble.Y = m_iconYPos - 30f + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
     if (!RoomCompleted)
     {
         if (CollisionMath.Intersects(Player.Bounds, m_pedestal.Bounds))
         {
             m_speechBubble.Visible = true;
             if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
             {
                 var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                 rCScreenManager.DialogueScreen.SetDialogue("Special Item Prayer");
                 rCScreenManager.DialogueScreen.SetDialogueChoice("ConfirmTest1");
                 rCScreenManager.DialogueScreen.SetConfirmEndHandler(this, "TakeItem");
                 rCScreenManager.DialogueScreen.SetCancelEndHandler(typeof(Console), "WriteLine",
                                                                    "Canceling Selection");
                 rCScreenManager.DisplayScreen(13, true);
             }
         }
         else
         {
             m_speechBubble.Visible = false;
         }
     }
     else
     {
         m_icon.Visible = false;
     }
     base.Update(gameTime);
 }
コード例 #2
0
 public override void Update(GameTime gameTime)
 {
     m_icon.Y         = m_iconYPos - 10f + (float)Math.Sin(Game.TotalGameTime * 2f) * 5f;
     m_speechBubble.Y = m_iconYPos - 90f + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
     if (!RoomCompleted)
     {
         m_icon.Visible = true;
         if (CollisionMath.Intersects(Player.Bounds, m_pedestal.Bounds))
         {
             m_speechBubble.Visible = true;
             if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
             {
                 TakeItem();
             }
         }
         else
         {
             m_speechBubble.Visible = false;
         }
     }
     else
     {
         m_icon.Visible = false;
     }
     base.Update(gameTime);
 }
コード例 #3
0
 public override void Update(GameTime gameTime)
 {
     if (!IsPaused)
     {
         if (Game.PlayerStats.Traits.X != 23f && Game.PlayerStats.Traits.Y != 23f)
         {
             if (CollisionMath.Intersects(AbsDetectionRect, m_target.Bounds))
             {
                 if (CurrentFrame == 1 || CurrentFrame == TotalFrames)
                 {
                     IsCollidable = true;
                     m_extractLS.Execute();
                 }
             }
             else if (CurrentFrame == 5 && !m_extractLS.IsActive)
             {
                 IsCollidable = false;
                 PlayAnimation("StartRetract", "RetractComplete");
             }
         }
         if (m_extractLS.IsActive)
         {
             m_extractLS.Update(gameTime);
         }
     }
     base.Update(gameTime);
 }
コード例 #4
0
        public void Update(GameTime gameTime, PlayerObj player)
        {
            var flag = false;

            if (Flip == SpriteEffects.None && player.X > X)
            {
                flag = true;
            }
            if (Flip != SpriteEffects.None && player.X < X)
            {
                flag = true;
            }
            if (player != null &&
                CollisionMath.Intersects(player.TerrainBounds,
                                         new Rectangle(Bounds.X - 50, Bounds.Y, Bounds.Width + 100, Bounds.Height)) && flag &&
                player.Flip != Flip && CanTalk)
            {
                m_talkIcon.Visible = true;
            }
            else
            {
                m_talkIcon.Visible = false;
            }
            if (Flip == SpriteEffects.None)
            {
                m_talkIcon.Position = new Vector2(Bounds.Left - m_talkIcon.AnchorX,
                                                  Bounds.Top - m_talkIcon.AnchorY + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f);
                return;
            }
            m_talkIcon.Position = new Vector2(Bounds.Right + m_talkIcon.AnchorX,
                                              Bounds.Top - m_talkIcon.AnchorY + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f);
        }
コード例 #5
0
 public override void Update(GameTime gameTime)
 {
     if (!RoomCompleted)
     {
         var bounds = m_fountain.Bounds;
         bounds.X     -= 50;
         bounds.Width += 100;
         if (CollisionMath.Intersects(Player.Bounds, bounds) && Player.IsTouchingGround)
         {
             m_speechBubble.Y       = m_fountain.Y - 150f + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
             m_speechBubble.Visible = true;
         }
         else
         {
             m_speechBubble.Visible = false;
         }
         if (m_speechBubble.Visible && (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)))
         {
             var num  = (int)(Player.MaxHealth * 0.3f);
             var num2 = (int)(Player.MaxMana * 0.3f);
             Player.CurrentHealth += num;
             Player.CurrentMana   += num2;
             Console.WriteLine("Healed");
             SoundManager.PlaySound("Collect_Mana");
             Player.AttachedLevel.TextManager.DisplayNumberStringText(num, "hp recovered", Color.LawnGreen,
                                                                      new Vector2(Player.X, Player.Bounds.Top - 30));
             Player.AttachedLevel.TextManager.DisplayNumberStringText(num2, "mp recovered", Color.CornflowerBlue,
                                                                      new Vector2(Player.X, Player.Bounds.Top));
             RoomCompleted           = true;
             m_fountain.TextureColor = new Color(100, 100, 100);
             m_speechBubble.Visible  = false;
         }
     }
     base.Update(gameTime);
 }
コード例 #6
0
 public override void Draw(Camera2D camera)
 {
     if (this.ShowTerrain && CollisionMath.Intersects(this.Bounds, camera.Bounds) || base.ForceDraw)
     {
         camera.Draw(Game.GenericTexture, base.Position, new Rectangle(0, 0, this.Width, this.Height), base.TextureColor, MathHelper.ToRadians(base.Rotation), Vector2.Zero, 1f, SpriteEffects.None, 0f);
     }
 }
コード例 #7
0
        private TerrainObj FindClosestCeiling()
        {
            var        num         = 2147483647;
            TerrainObj result      = null;
            var        currentRoom = m_levelScreen.CurrentRoom;

            foreach (var current in currentRoom.TerrainObjList)
            {
                var b = new Rectangle(Bounds.Left, Bounds.Top - 2000, Bounds.Width, Bounds.Height + 2000);
                if (current.CollidesBottom && CollisionMath.Intersects(current.Bounds, b))
                {
                    var num2 = 3.40282347E+38f;
                    if (current.Bounds.Bottom < TerrainBounds.Top)
                    {
                        num2 = TerrainBounds.Top - current.Bounds.Bottom;
                    }
                    if (num2 < num)
                    {
                        num    = (int)num2;
                        result = current;
                    }
                }
            }
            return(result);
        }
コード例 #8
0
        public override void Update(GameTime gameTime)
        {
            if (m_bossDoorOpening && !Player.ControlsLocked)
            {
                Player.LockControls();
            }
            if (!SoundManager.IsMusicPlaying)
            {
                SoundManager.PlayMusic("CastleSong", true);
            }
            if (Player.X < m_castleGate.Bounds.Right)
            {
                Player.X = m_castleGate.Bounds.Right + 20;
                Player.AttachedLevel.UpdateCamera();
            }
            var bounds = m_diary.Bounds;

            bounds.X        -= 50;
            bounds.Width    += 100;
            m_speechBubble.Y = m_diary.Y - m_speechBubble.Height - 20f - 30f +
                               (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
            if (CollisionMath.Intersects(Player.Bounds, bounds) && Player.IsTouchingGround)
            {
                if (m_speechBubble.SpriteName == "ExclamationSquare_Sprite")
                {
                    m_speechBubble.ChangeSprite("UpArrowSquare_Sprite");
                }
            }
            else if (m_speechBubble.SpriteName == "UpArrowSquare_Sprite")
            {
                m_speechBubble.ChangeSprite("ExclamationSquare_Sprite");
            }
            if (Game.PlayerStats.DiaryEntry < 1 || CollisionMath.Intersects(Player.Bounds, bounds))
            {
                m_speechBubble.Visible = true;
            }
            else if (Game.PlayerStats.DiaryEntry >= 1 && !CollisionMath.Intersects(Player.Bounds, bounds))
            {
                m_speechBubble.Visible = false;
            }
            if (CollisionMath.Intersects(Player.Bounds, bounds) && Player.IsTouchingGround &&
                (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)))
            {
                if (Game.PlayerStats.DiaryEntry < 1)
                {
                    var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                    rCScreenManager.DialogueScreen.SetDialogue("DiaryEntry0");
                    rCScreenManager.DisplayScreen(13, true);
                    var expr_24E = Game.PlayerStats;
                    expr_24E.DiaryEntry += 1;
                }
                else
                {
                    var rCScreenManager2 = Player.AttachedLevel.ScreenManager as RCScreenManager;
                    rCScreenManager2.DisplayScreen(20, true);
                }
            }
            base.Update(gameTime);
        }
コード例 #9
0
        public override void Update(GameTime gameTime)
        {
            if (m_target.AttachedLevel.CurrentRoom.Name != "Ending")
            {
                m_gallopSound.Update();
            }
            var num = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (Difficulty >= GameTypes.EnemyDifficulty.ADVANCED && m_fireDropTimer > 0f)
            {
                m_fireDropTimer -= num;
                if (m_fireDropTimer <= 0f)
                {
                    DropFireProjectile();
                    m_fireDropTimer = m_fireDropInterval;
                }
            }
            if (Difficulty == GameTypes.EnemyDifficulty.EXPERT && !IsPaused && m_fireShieldList.Count < 1)
            {
                CastFireShield(m_numFireShieldObjs);
            }
            if ((Bounds.Left < m_levelScreen.CurrentRoom.Bounds.Left ||
                 Bounds.Right > m_levelScreen.CurrentRoom.Bounds.Right) && m_collisionCheckTimer <= 0f)
            {
                TurnHorse();
            }
            var b  = default(Rectangle);
            var b2 = default(Rectangle);

            if (Flip == SpriteEffects.FlipHorizontally)
            {
                b  = new Rectangle(Bounds.Left - 10, Bounds.Bottom + 20, 5, 5);
                b2 = new Rectangle(Bounds.Right + 50, Bounds.Bottom - 20, 5, 5);
            }
            else
            {
                b  = new Rectangle(Bounds.Right + 10, Bounds.Bottom + 20, 5, 5);
                b2 = new Rectangle(Bounds.Left - 50, Bounds.Bottom - 20, 5, 5);
            }
            var flag = true;

            foreach (var current in m_levelScreen.CurrentRoom.TerrainObjList)
            {
                if (CollisionMath.Intersects(current.Bounds, b) || CollisionMath.Intersects(current.Bounds, b2))
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                TurnHorse();
            }
            if (m_collisionCheckTimer > 0f)
            {
                m_collisionCheckTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            base.Update(gameTime);
        }
コード例 #10
0
 public override void Update(GameTime gameTime)
 {
     if (CollisionMath.Intersects(Player.Bounds, m_teleporter.Bounds) && Player.IsTouchingGround &&
         (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)))
     {
         TeleportPlayer();
     }
 }
コード例 #11
0
 public override void Draw(Camera2D camera)
 {
     if ((ShowTerrain && CollisionMath.Intersects(Bounds, camera.Bounds)) || ForceDraw)
     {
         camera.Draw(Game.GenericTexture, Position, new Rectangle(0, 0, Width, Height), TextureColor,
                     MathHelper.ToRadians(Rotation), Vector2.Zero, 1f, SpriteEffects.None, 0f);
     }
 }
コード例 #12
0
 public override void Update(GameTime gameTime)
 {
     if (m_levelScreen != null && m_levelScreen.CurrentRoom != null && !IsKilled &&
         !CollisionMath.Intersects(TerrainBounds, m_levelScreen.CurrentRoom.Bounds))
     {
         Kill();
     }
     base.Update(gameTime);
 }
コード例 #13
0
        public override void Update(GameTime gameTime)
        {
            m_speechBubble.Y = m_diary.Y - m_speechBubble.Height - 20f - 30f +
                               (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
            var bounds = m_diary.Bounds;

            bounds.X     -= 50;
            bounds.Width += 100;
            if (!CollisionMath.Intersects(Player.Bounds, bounds) && m_speechBubble.SpriteName == "UpArrowSquare_Sprite")
            {
                m_speechBubble.ChangeSprite("ExclamationSquare_Sprite");
            }
            if (!RoomCompleted || CollisionMath.Intersects(Player.Bounds, bounds))
            {
                m_speechBubble.Visible = true;
            }
            else if (RoomCompleted && !CollisionMath.Intersects(Player.Bounds, bounds))
            {
                m_speechBubble.Visible = false;
            }
            if (m_diaryIndex >= 24)
            {
                m_speechBubble.Visible = false;
            }
            if (CollisionMath.Intersects(Player.Bounds, bounds) && Player.IsTouchingGround)
            {
                if (m_speechBubble.SpriteName == "ExclamationSquare_Sprite")
                {
                    m_speechBubble.ChangeSprite("UpArrowSquare_Sprite");
                }
                if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
                {
                    if (!RoomCompleted && Game.PlayerStats.DiaryEntry < 24)
                    {
                        var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                        rCScreenManager.DialogueScreen.SetDialogue("DiaryEntry" + m_diaryIndex);
                        rCScreenManager.DisplayScreen(13, true);
                        var expr_1DB = Game.PlayerStats;
                        expr_1DB.DiaryEntry += 1;
                        RoomCompleted        = true;
                    }
                    else
                    {
                        RoomCompleted = true;
                        var rCScreenManager2 = Player.AttachedLevel.ScreenManager as RCScreenManager;
                        rCScreenManager2.DisplayScreen(20, true);
                    }
                }
            }
            base.Update(gameTime);
        }
コード例 #14
0
 public void Update(List <TerrainObj> collisionList, GameTime gameTime)
 {
     if (!m_splashing)
     {
         var num = (float)gameTime.ElapsedGameTime.TotalSeconds;
         Y += m_speedY * num;
         X += m_speedX * num;
         if (IsCollidable)
         {
             var bounds = Bounds;
             foreach (var current in collisionList)
             {
                 var terrainObj = current;
                 var bounds2    = terrainObj.Bounds;
                 if (terrainObj.Visible && terrainObj.CollidesTop && terrainObj.Y > 120f &&
                     CollisionMath.Intersects(bounds, bounds2))
                 {
                     if (terrainObj.Rotation == 0f)
                     {
                         if (!m_isSnowflake)
                         {
                             Y = bounds2.Top - 10;
                         }
                         RunSplashAnimation();
                         break;
                     }
                     if (terrainObj.Rotation != 0f &&
                         CollisionMath.RotatedRectIntersects(bounds, 0f, Vector2.Zero,
                                                             new Rectangle((int)terrainObj.X, (int)terrainObj.Y, terrainObj.Width,
                                                                           terrainObj.Height), terrainObj.Rotation, Vector2.Zero))
                     {
                         if (!m_isSnowflake)
                         {
                             Y -= 12f;
                         }
                         RunSplashAnimation();
                     }
                     break;
                 }
             }
         }
         if (Y > 720f)
         {
             RunSplashAnimation();
         }
     }
     if (!IsAnimating && m_splashing && !m_isSnowflake)
     {
         KillDrop();
     }
 }
コード例 #15
0
 public override void Update(GameTime gameTime)
 {
     if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
     {
         var b = new Rectangle(Bounds.Center.X - 100, Bounds.Bottom - 300, 200, 200);
         if (CollisionMath.Intersects(Player.Bounds, b) && Player.IsTouchingGround && ID > -1)
         {
             var screenManager = Game.ScreenManager;
             screenManager.DialogueScreen.SetDialogue("PortraitRoomText" + ID);
             screenManager.DisplayScreen(13, true);
         }
     }
     base.Update(gameTime);
 }
コード例 #16
0
        public void Update(Camera2D camera)
        {
            var player = m_screenManager.Player;

            foreach (var current in m_projectileManager.ActiveProjectileList)
            {
                if (current.ShowIcon)
                {
                    if (current.AttachedIcon == null)
                    {
                        if (!CollisionMath.Intersects(current.Bounds, camera.Bounds) &&
                            ((current.AccelerationX > 1f && current.X < player.X && current.Y > camera.Bounds.Top &&
                              current.Y < camera.Bounds.Bottom) ||
                             (current.AccelerationX < -1f && current.X > player.X && current.Y > camera.Bounds.Top &&
                              current.Y < camera.Bounds.Bottom) ||
                             (current.AccelerationY > 1f && current.Y < player.Y && current.X > camera.Bounds.Left &&
                              current.X < camera.Bounds.Right) ||
                             (current.AccelerationY < -1f && current.Y > player.Y && current.X > camera.Bounds.Left &&
                              current.X < camera.Bounds.Right)))
                        {
                            AddIcon(current);
                        }
                    }
                    else if (CollisionMath.Intersects(current.Bounds, camera.Bounds))
                    {
                        DestroyIcon(current);
                    }
                }
            }
            for (var i = 0; i < m_resourcePool.ActiveObjsList.Count; i++)
            {
                if (!m_resourcePool.ActiveObjsList[i].AttachedProjectile.IsAlive)
                {
                    DestroyIcon(m_resourcePool.ActiveObjsList[i].AttachedProjectile);
                    i--;
                }
            }
            foreach (var current2 in m_resourcePool.ActiveObjsList)
            {
                current2.Update(camera);
            }
        }
コード例 #17
0
 public override void Update(GameTime gameTime)
 {
     if (CollisionMath.Intersects(Player.Bounds, m_jukeBox.Bounds))
     {
         m_speechBubble.Visible = true;
         m_speechBubble.Y       = m_jukeBox.Y - m_speechBubble.Height - 110f +
                                  (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
         if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
         {
             Tween.StopAllContaining(m_jukeBox, false);
             m_jukeBox.Scale    = new Vector2(3f, 3f);
             m_jukeBox.Rotation = 0f;
             Tween.StopAllContaining(m_nowPlayingText, false);
             Tween.StopAllContaining(m_songTitle, false);
             m_songTitle.Opacity      = 0f;
             m_nowPlayingText.Opacity = 0f;
             Tween.To(m_songTitle, 0.5f, Linear.EaseNone, "delay", "0.2", "Opacity", "1");
             m_songTitle.Opacity = 1f;
             Tween.To(m_songTitle, 0.5f, Linear.EaseNone, "delay", "2.2", "Opacity", "0");
             m_songTitle.Opacity = 0f;
             Tween.To(m_nowPlayingText, 0.5f, Linear.EaseNone, "Opacity", "1");
             m_nowPlayingText.Opacity = 1f;
             Tween.To(m_nowPlayingText, 0.5f, Linear.EaseNone, "delay", "2", "Opacity", "0");
             m_nowPlayingText.Opacity = 0f;
             SoundManager.PlayMusic(m_songList[m_songIndex], true, 1f);
             m_songTitle.Text = m_songTitleList[m_songIndex];
             m_songIndex++;
             if (m_songIndex > m_songList.Length - 1)
             {
                 m_songIndex = 0;
             }
             AnimateJukebox();
             CheckForSongRepeat();
         }
     }
     else
     {
         m_speechBubble.Visible = false;
     }
     base.Update(gameTime);
 }
コード例 #18
0
        public override void Update(GameTime gameTime)
        {
            Player.CurrentMana         = Player.MaxMana;
            Player.CurrentHealth       = Player.MaxHealth;
            m_enchantressBlock.Visible = EnchantressAvailable;
            m_blacksmithBlock.Visible  = SmithyAvailable;
            m_architectBlock.Visible   = ArchitectAvailable;
            var totalGameTime = Game.TotalGameTime;

            if (!m_playerWalkedOut)
            {
                if (!Player.ControlsLocked && Player.X < Bounds.Left)
                {
                    m_playerWalkedOut = true;
                    (Player.AttachedLevel.ScreenManager as RCScreenManager).StartWipeTransition();
                    Tween.RunFunction(0.2f, Player.AttachedLevel.ScreenManager, "DisplayScreen", 6, true,
                                      typeof(List <object>));
                }
                else if (!Player.ControlsLocked && Player.X > Bounds.Right && !TollCollectorAvailable)
                {
                    m_playerWalkedOut = true;
                    LoadLevel();
                }
            }
            if (m_isRaining)
            {
                foreach (var current in TerrainObjList)
                {
                    current.UseCachedValues = true;
                }
                foreach (var current2 in m_rainFG)
                {
                    current2.Update(TerrainObjList, gameTime);
                }
            }
            m_tree1.Rotation = -(float)Math.Sin(totalGameTime) * 2f;
            m_tree2.Rotation = (float)Math.Sin(totalGameTime * 2f);
            m_tree3.Rotation = (float)Math.Sin(totalGameTime * 2f) * 2f;
            m_fern1.Rotation = (float)Math.Sin(totalGameTime * 3f) / 2f;
            m_fern2.Rotation = -(float)Math.Sin(totalGameTime * 4f);
            m_fern3.Rotation = (float)Math.Sin(totalGameTime * 4f) / 2f;
            if (!m_architectRenovating)
            {
                HandleInput();
            }
            if (SmithyAvailable)
            {
                if (m_blacksmithAnvilSound != null)
                {
                    m_blacksmithAnvilSound.Update();
                }
                m_blacksmith.Update(gameTime);
            }
            m_blacksmithIcon.Visible = false;
            if (Player != null && CollisionMath.Intersects(Player.TerrainBounds, m_blacksmith.Bounds) &&
                Player.IsTouchingGround && SmithyAvailable)
            {
                m_blacksmithIcon.Visible = true;
            }
            m_blacksmithIcon.Position = new Vector2(m_blacksmithIconPosition.X,
                                                    m_blacksmithIconPosition.Y - 70f + (float)Math.Sin(totalGameTime * 20f) * 2f);
            m_enchantressIcon.Visible = false;
            var b = new Rectangle((int)(m_enchantress.X - 100f), (int)m_enchantress.Y,
                                  m_enchantress.Bounds.Width + 100, m_enchantress.Bounds.Height);

            if (Player != null && CollisionMath.Intersects(Player.TerrainBounds, b) && Player.IsTouchingGround &&
                EnchantressAvailable)
            {
                m_enchantressIcon.Visible = true;
            }
            m_enchantressIcon.Position = new Vector2(m_enchantressIconPosition.X + 20f,
                                                     m_enchantressIconPosition.Y + (float)Math.Sin(totalGameTime * 20f) * 2f);
            if (Player != null &&
                CollisionMath.Intersects(Player.TerrainBounds,
                                         new Rectangle((int)m_architect.X - 100, (int)m_architect.Y, m_architect.Width + 200,
                                                       m_architect.Height)) && Player.X < m_architect.X && Player.Flip == SpriteEffects.None &&
                ArchitectAvailable)
            {
                m_architectIcon.Visible = true;
            }
            else
            {
                m_architectIcon.Visible = false;
            }
            m_architectIcon.Position = new Vector2(m_architectIconPosition.X,
                                                   m_architectIconPosition.Y + (float)Math.Sin(totalGameTime * 20f) * 2f);
            if (Player != null &&
                CollisionMath.Intersects(Player.TerrainBounds,
                                         new Rectangle((int)m_tollCollector.X - 100, (int)m_tollCollector.Y, m_tollCollector.Width + 200,
                                                       m_tollCollector.Height)) && Player.X < m_tollCollector.X && Player.Flip == SpriteEffects.None &&
                TollCollectorAvailable && m_tollCollector.SpriteName == "NPCTollCollectorIdle_Character")
            {
                m_tollCollectorIcon.Visible = true;
            }
            else
            {
                m_tollCollectorIcon.Visible = false;
            }
            m_tollCollectorIcon.Position = new Vector2(m_tollCollector.X - m_tollCollector.Width / 2 - 10f,
                                                       m_tollCollector.Y - m_tollCollectorIcon.Height - m_tollCollector.Height / 2 +
                                                       (float)Math.Sin(totalGameTime * 20f) * 2f);
            m_blacksmithNewIcon.Visible = false;
            if (SmithyAvailable)
            {
                if (m_blacksmithIcon.Visible && m_blacksmithNewIcon.Visible)
                {
                    m_blacksmithNewIcon.Visible = false;
                }
                else if (!m_blacksmithIcon.Visible && BlacksmithNewIconVisible)
                {
                    m_blacksmithNewIcon.Visible = true;
                }
                m_blacksmithNewIcon.Position = new Vector2(m_blacksmithIcon.X + 50f, m_blacksmithIcon.Y - 30f);
            }
            m_enchantressNewIcon.Visible = false;
            if (EnchantressAvailable)
            {
                if (m_enchantressIcon.Visible && m_enchantressNewIcon.Visible)
                {
                    m_enchantressNewIcon.Visible = false;
                }
                else if (!m_enchantressIcon.Visible && EnchantressNewIconVisible)
                {
                    m_enchantressNewIcon.Visible = true;
                }
                m_enchantressNewIcon.Position = new Vector2(m_enchantressIcon.X + 40f, m_enchantressIcon.Y - 0f);
            }
            if (m_isRaining && !m_isSnowing && m_lightningTimer > 0f)
            {
                m_lightningTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (m_lightningTimer <= 0f)
                {
                    if (CDGMath.RandomInt(0, 100) > 70)
                    {
                        if (CDGMath.RandomInt(0, 1) > 0)
                        {
                            Player.AttachedLevel.LightningEffectTwice();
                        }
                        else
                        {
                            Player.AttachedLevel.LightningEffectOnce();
                        }
                    }
                    m_lightningTimer = 5f;
                }
            }
            if (m_shakeScreen)
            {
                UpdateShake();
            }
            if (Player.Bounds.Right > m_tollCollector.Bounds.Left && TollCollectorAvailable)
            {
                Player.X = m_tollCollector.Bounds.Left - (Player.Bounds.Right - Player.X);
                Player.AttachedLevel.UpdateCamera();
            }
            base.Update(gameTime);
        }
コード例 #19
0
 public override void Update(GameTime gameTime)
 {
     if (!Game.PlayerStats.TutorialComplete)
     {
         var waypointIndex = m_waypointIndex;
         m_waypointIndex = PlayerNearWaypoint();
         if (m_waypointIndex != waypointIndex)
         {
             Tween.StopAllContaining(m_tutorialText, false);
             if (m_waypointIndex != -1)
             {
                 if (!InputManager.GamePadIsConnected(PlayerIndex.One))
                 {
                     m_tutorialText.Text = m_tutorialTextList[m_waypointIndex];
                 }
                 else
                 {
                     m_tutorialText.Text = m_tutorialControllerTextList[m_waypointIndex];
                 }
                 Tween.To(m_tutorialText, 0.25f, Tween.EaseNone, "Opacity", "1");
             }
             else
             {
                 Tween.To(m_tutorialText, 0.25f, Tween.EaseNone, "Opacity", "0");
             }
         }
     }
     else
     {
         var bounds = m_diary.Bounds;
         bounds.X        -= 50;
         bounds.Width    += 100;
         m_speechBubble.Y = m_diary.Y - m_speechBubble.Height - 20f - 30f +
                            (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;
         if (CollisionMath.Intersects(Player.Bounds, bounds) && Player.IsTouchingGround)
         {
             if (m_speechBubble.SpriteName == "ExclamationSquare_Sprite")
             {
                 m_speechBubble.ChangeSprite("UpArrowSquare_Sprite");
             }
             if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
             {
                 if (!Game.PlayerStats.ReadLastDiary)
                 {
                     var rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                     rCScreenManager.DialogueScreen.SetDialogue("DiaryEntry" + 24);
                     rCScreenManager.DialogueScreen.SetConfirmEndHandler(this, "RunFlashback");
                     rCScreenManager.DisplayScreen(13, true);
                 }
                 else
                 {
                     var rCScreenManager2 = Player.AttachedLevel.ScreenManager as RCScreenManager;
                     rCScreenManager2.DisplayScreen(20, true);
                 }
             }
         }
         else if (m_speechBubble.SpriteName == "UpArrowSquare_Sprite")
         {
             m_speechBubble.ChangeSprite("ExclamationSquare_Sprite");
         }
         if (!Game.PlayerStats.ReadLastDiary || CollisionMath.Intersects(Player.Bounds, bounds))
         {
             m_speechBubble.Visible = true;
         }
         else if (Game.PlayerStats.ReadLastDiary && !CollisionMath.Intersects(Player.Bounds, bounds))
         {
             m_speechBubble.Visible = false;
         }
     }
     base.Update(gameTime);
 }
コード例 #20
0
 public override void Draw(Camera2D camera)
 {
     if (FlipPortrait)
     {
         m_playerSprite.Rotation = 180f;
     }
     if (!m_frameDropping)
     {
         m_frameSprite.Position = Position;
         m_frameSprite.Y       -= 12f;
         m_frameSprite.X       += 5f;
     }
     m_frameSprite.Opacity = Opacity;
     m_frameSprite.Draw(camera);
     if (!IsDead && Spell != 0)
     {
         m_spellIconHolder.Position = new Vector2(m_frameSprite.X, m_frameSprite.Bounds.Bottom - 20);
         m_spellIcon.Position       = m_spellIconHolder.Position;
         m_spellIconHolder.Draw(camera);
         m_spellIcon.Draw(camera);
     }
     m_playerSprite.OutlineColour = OutlineColour;
     m_playerSprite.OutlineWidth  = OutlineWidth;
     if (!m_frameDropping)
     {
         m_playerSprite.Position = Position;
         m_playerSprite.X       += 10f;
         if (FlipPortrait)
         {
             m_playerSprite.X -= 10f;
             m_playerSprite.Y -= 30f;
         }
     }
     m_playerSprite.Opacity = Opacity;
     m_playerSprite.Draw(camera);
     if (CollisionMath.Intersects(Bounds, camera.Bounds))
     {
         if (Class == 7 || Class == 15)
         {
             Game.ColourSwapShader.Parameters["desiredTint"].SetValue(Color.White.ToVector4());
             Game.ColourSwapShader.Parameters["Opacity"].SetValue(m_playerSprite.Opacity);
             Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(m_skinColour1.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(m_lichColour1.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(m_skinColour2.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(m_lichColour2.ToVector4());
             camera.End();
             camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null,
                          Game.ColourSwapShader, camera.GetTransformation());
             m_playerSprite.GetChildAt(12).Draw(camera);
             camera.End();
             camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null,
                          null, camera.GetTransformation());
             if (IsFemale)
             {
                 m_playerSprite.GetChildAt(13).Draw(camera);
             }
             m_playerSprite.GetChildAt(15).Draw(camera);
         }
         else if (Class == 3 || Class == 11)
         {
             Game.ColourSwapShader.Parameters["desiredTint"].SetValue(Color.White.ToVector4());
             Game.ColourSwapShader.Parameters["Opacity"].SetValue(m_playerSprite.Opacity);
             Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(m_skinColour1.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(Color.Black.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(m_skinColour2.ToVector4());
             Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(Color.Black.ToVector4());
             camera.End();
             camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null,
                          Game.ColourSwapShader, camera.GetTransformation());
             m_playerSprite.GetChildAt(12).Draw(camera);
             camera.End();
             camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null,
                          null, camera.GetTransformation());
             if (IsFemale)
             {
                 m_playerSprite.GetChildAt(13).Draw(camera);
             }
             m_playerSprite.GetChildAt(15).Draw(camera);
         }
     }
     if (!DisablePlaque)
     {
         if (!m_frameDropping)
         {
             m_plaqueSprite.Position = Position;
             m_plaqueSprite.X       += 5f;
             m_plaqueSprite.Y        = m_frameSprite.Y + m_frameSprite.Height - 30f;
         }
         m_plaqueSprite.Draw(camera);
         camera.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;
         base.Draw(camera);
         camera.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
     }
     if (m_frameDropping)
     {
         m_frameSprite.Draw(camera);
         m_playerSprite.Draw(camera);
     }
 }
コード例 #21
0
        public void CastEarthSpellOut()
        {
            m_earthSummonOutSprite.Scale = Vector2.Zero;
            m_earthSummonOutSprite.X     = m_target.X;
            var        num        = 2147483647;
            TerrainObj terrainObj = null;

            foreach (var current in m_levelScreen.CurrentRoom.TerrainObjList)
            {
                if (CollisionMath.Intersects(new Rectangle((int)m_target.X, (int)m_target.Y, 2, 720), current.Bounds))
                {
                    var num2 = current.Bounds.Top - m_target.TerrainBounds.Bottom;
                    if (num2 < num)
                    {
                        num        = num2;
                        terrainObj = current;
                    }
                }
            }
            if (terrainObj != null)
            {
                if (terrainObj.Rotation == 0f)
                {
                    m_earthSummonOutSprite.Y = terrainObj.Bounds.Top;
                }
                else
                {
                    Vector2 vector;
                    Vector2 vector2;
                    if (terrainObj.Width > terrainObj.Height)
                    {
                        vector = CollisionMath.UpperLeftCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                               Vector2.Zero);
                        vector2 = CollisionMath.UpperRightCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                                 Vector2.Zero);
                    }
                    else if (terrainObj.Rotation > 0f)
                    {
                        vector = CollisionMath.LowerLeftCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                               Vector2.Zero);
                        vector2 = CollisionMath.UpperLeftCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                                Vector2.Zero);
                    }
                    else
                    {
                        vector = CollisionMath.UpperRightCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                                Vector2.Zero);
                        vector2 = CollisionMath.LowerRightCorner(terrainObj.TerrainBounds, terrainObj.Rotation,
                                                                 Vector2.Zero);
                    }
                    var num3 = vector2.X - vector.X;
                    var num4 = vector2.Y - vector.Y;
                    var x    = vector.X;
                    var y    = vector.Y;
                    var x2   = m_earthSummonOutSprite.X;
                    var num5 = y + (x2 - x) * (num4 / num3);
                    num5 -= m_earthSummonOutSprite.Bounds.Bottom - m_earthSummonOutSprite.Y;
                    m_earthSummonOutSprite.Y = (float)Math.Round(num5, MidpointRounding.ToEven);
                }
            }
            object arg_2A0_0 = m_earthSummonOutSprite;
            var    arg_2A0_1 = 0.5f;
            Easing arg_2A0_2 = Back.EaseOut;
            var    array     = new string[6];

            array[0] = "Opacity";
            array[1] = "1";
            array[2] = "ScaleX";
            var arg_28B_0 = array;
            var arg_28B_1 = 3;
            var x3        = ProjectileScale.X;

            arg_28B_0[arg_28B_1] = x3.ToString();
            array[4]             = "ScaleY";
            array[5]             = "1";
            Tween.To(arg_2A0_0, arg_2A0_1, arg_2A0_2, array);
        }
コード例 #22
0
        public override void Update(GameTime gameTime)
        {
            if (Game.PlayerStats.TutorialComplete)
            {
                Rectangle bounds = m_diary.Bounds;
                bounds.X     -= 50;
                bounds.Width += 100;

                m_speechBubble.Y = m_diary.Y - m_speechBubble.Height - 20f - 30f + (float)Math.Sin(Game.TotalGameTime * 20f) * 2f;

                var intersects = CollisionMath.Intersects(Player.Bounds, bounds);

                if (intersects && Player.IsTouchingGround)
                {
                    if (m_speechBubble.SpriteName == "ExclamationSquare_Sprite")
                    {
                        m_speechBubble.ChangeSprite("UpArrowSquare_Sprite");
                    }

                    if (InputManager.IsNewlyPressed(InputFlags.PlayerUp1 | InputFlags.PlayerUp2))
                    {
                        if (Game.PlayerStats.ReadLastDiary)
                        {
                            RCScreenManager screenManager = this.Player.AttachedLevel.ScreenManager as RCScreenManager;
                            screenManager.DisplayScreen(ScreenType.DiaryEntry, true, null);
                        }
                        else
                        {
                            RCScreenManager rCScreenManager = Player.AttachedLevel.ScreenManager as RCScreenManager;
                            rCScreenManager.DialogueScreen.SetDialogue("DiaryEntry" + 24);
                            rCScreenManager.DialogueScreen.SetConfirmEndHandler(this, "RunFlashback");
                            rCScreenManager.DisplayScreen(ScreenType.Dialogue, true, null);
                        }
                    }
                }
                else if (m_speechBubble.SpriteName == "UpArrowSquare_Sprite")
                {
                    m_speechBubble.ChangeSprite("ExclamationSquare_Sprite");
                }


                if (!Game.PlayerStats.ReadLastDiary || intersects)
                {
                    m_speechBubble.Visible = true;
                }
                else if (Game.PlayerStats.ReadLastDiary && !intersects)
                {
                    m_speechBubble.Visible = false;
                }
            }
            else
            {
                int lastWaypoint = m_waypointIndex;
                m_waypointIndex = PlayerNearWaypoint();
                if (m_waypointIndex != lastWaypoint)
                {
                    Tween.StopAllContaining(m_tutorialText, false);
                    if (m_waypointIndex == -1)
                    {
                        Tween.To(m_tutorialText, 0.25f, Tween.EaseNone, "Opacity", "0");
                    }
                    else
                    {
                        if (InputManager.IsGamepadConnected())
                        {
                            m_tutorialText.Text = m_tutorialControllerTextList[m_waypointIndex];
                        }
                        else
                        {
                            m_tutorialText.Text = m_tutorialTextList[m_waypointIndex];
                        }

                        Tween.To(m_tutorialText, 0.25f, Tween.EaseNone, "Opacity", "1");
                    }
                }
            }
            base.Update(gameTime);
        }
コード例 #23
0
ファイル: CreditsScreen.cs プロジェクト: Azarem/RogueLauncher
        public override void Draw(GameTime gametime)
        {
            base.Camera.GraphicsDevice.SetRenderTarget(m_skyRenderTarget);
            base.Camera.GraphicsDevice.Clear(Color.Black);
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, null, null);
            m_sky.Draw(base.Camera);
            base.Camera.End();
            base.Camera.GraphicsDevice.SetRenderTarget(m_backgroundRenderTarget);
            base.Camera.GraphicsDevice.Clear(Color.Black);
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
            m_bg1.Draw(base.Camera);
            m_bg2.Draw(base.Camera);
            m_bg3.Draw(base.Camera);
            m_bgOutside.Draw(base.Camera);
            m_ground1.Draw(base.Camera);
            m_ground2.Draw(base.Camera);
            m_ground3.Draw(base.Camera);
            m_border1.Draw(base.Camera);
            m_border2.Draw(base.Camera);
            m_border3.Draw(base.Camera);
            m_manor.Draw(base.Camera);
            m_prop1.Draw(base.Camera);
            m_prop2.Draw(base.Camera);
            m_prop3.Draw(base.Camera);
            m_playerSprite.Draw(base.Camera);
            EffectParameter item         = Game.ColourSwapShader.Parameters["desiredTint"];
            Color           textureColor = m_playerSprite.GetChildAt(12).TextureColor;

            item.SetValue(textureColor.ToVector4());

            var args = RogueAPI.Game.Player.PipeSkinShaderArgs(this, m_playerSprite);

            Game.ColourSwapShader.Parameters["Opacity"].SetValue(args.Target.Opacity);
            Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(args.Target.ColorSwappedOut1.ToVector4());
            Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(args.Target.ColorSwappedIn1.ToVector4());
            Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(args.Target.ColorSwappedOut2.ToVector4());
            Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(args.Target.ColorSwappedIn2.ToVector4());

            //if (Game.PlayerStats.Class == 7 || Game.PlayerStats.Class == 15)
            //{
            //    Game.ColourSwapShader.Parameters["Opacity"].SetValue(this.m_playerSprite.Opacity);
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(this.m_skinColour1.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(this.m_lichColour1.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(this.m_skinColour2.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(this.m_lichColour2.ToVector4());
            //}
            //else if (Game.PlayerStats.Class == 3 || Game.PlayerStats.Class == 11)
            //{
            //    Game.ColourSwapShader.Parameters["Opacity"].SetValue(this.m_playerSprite.Opacity);
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(this.m_skinColour1.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(Color.Black.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(this.m_skinColour2.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(Color.Black.ToVector4());
            //}
            //else
            //{
            //    Game.ColourSwapShader.Parameters["Opacity"].SetValue(1);
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut1"].SetValue(this.m_skinColour1.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn1"].SetValue(this.m_skinColour1.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedOut2"].SetValue(this.m_skinColour2.ToVector4());
            //    Game.ColourSwapShader.Parameters["ColourSwappedIn2"].SetValue(this.m_skinColour2.ToVector4());
            //}
            base.Camera.End();
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, Game.ColourSwapShader);
            m_playerSprite.GetChildAt(12).Draw(base.Camera);
            base.Camera.End();
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null);
            if (Game.PlayerStats.IsFemale)
            {
                m_playerSprite.GetChildAt(13).Draw(base.Camera);
            }
            m_playerSprite.GetChildAt(15).Draw(base.Camera);
            m_wifeSprite.Draw(base.Camera);
            m_childSprite1.Draw(base.Camera);
            m_childSprite2.Draw(base.Camera);
            m_sideBorderLeft.Draw(base.Camera);
            m_sideBorderRight.Draw(base.Camera);
            m_sideBorderTop.Draw(base.Camera);
            m_sideBorderBottom.Draw(base.Camera);
            m_teddy.Draw(base.Camera);
            m_kenny.Draw(base.Camera);
            m_glauber.Draw(base.Camera);
            m_gordon.Draw(base.Camera);
            m_judson.Draw(base.Camera);
            base.Camera.End();
            base.Camera.GraphicsDevice.SetRenderTarget((base.ScreenManager as RCScreenManager).RenderTarget);
            base.Camera.GraphicsDevice.Textures[1] = m_skyRenderTarget;
            base.Camera.GraphicsDevice.Textures[1].GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp;
            base.Camera.GraphicsDevice.SetRenderTarget((base.ScreenManager as RCScreenManager).RenderTarget);
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, Game.ParallaxEffect);
            base.Camera.Draw(m_backgroundRenderTarget, Vector2.Zero, Color.White);
            base.Camera.End();
            base.Camera.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null);
            base.Camera.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;
            Rectangle rectangle = new Rectangle(0, 0, 1320, 720);

            foreach (TextObj mCreditsTitleList in m_creditsTitleList)
            {
                if (!CollisionMath.Intersects(mCreditsTitleList.Bounds, rectangle))
                {
                    continue;
                }
                mCreditsTitleList.Draw(base.Camera);
            }
            foreach (TextObj mCreditsNameList in m_creditsNameList)
            {
                if (!CollisionMath.Intersects(mCreditsNameList.Bounds, rectangle))
                {
                    continue;
                }
                mCreditsNameList.Draw(base.Camera);
            }
            m_thanksForPlayingText.Draw(base.Camera);
            m_totalDeaths.Draw(base.Camera);
            m_totalPlayTime.Draw(base.Camera);
            m_continueText.Draw(base.Camera);
            base.Camera.End();
            base.Draw(gametime);
        }