コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            if (m_playDeathLoop && (m_deathLoop == null || !m_deathLoop.IsPlaying))
            {
                m_deathLoop = SoundManager.PlaySound("Boss_Eyeball_Death_Loop");
            }
            var num  = m_target.Y - Y;
            var num2 = m_target.X - X;
            var num3 = (float)Math.Atan2(num, num2);

            m_pupil.X = (float)Math.Cos(num3) * PupilOffset;
            m_pupil.Y = (float)Math.Sin(num3) * PupilOffset;
            if (m_shake && m_shakeTimer > 0f)
            {
                m_shakeTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (m_shakeTimer <= 0f)
                {
                    m_shakeTimer = m_shakeDuration;
                    if (m_shookLeft)
                    {
                        m_shookLeft = false;
                        X          += 5f;
                    }
                    else
                    {
                        X          -= 5f;
                        m_shookLeft = true;
                    }
                }
            }
            m_squishSound.Update();
            base.Update(gameTime);
        }
コード例 #2
0
 public override void Update(GameTime gameTime)
 {
     if (!IsPaused)
     {
         if (!IsKilled && m_initialDelayCounter <= 0f)
         {
             var num = (float)gameTime.ElapsedGameTime.TotalSeconds;
             if (m_actualChainRadius < ChainRadius)
             {
                 m_actualChainRadius += num * 200f;
                 m_chainLinkDistance  = m_actualChainRadius / m_numChainLinks;
             }
             var num2 = 0f;
             BallAndChain.Position = CDGMath.GetCirclePosition(m_ballAngle, m_actualChainRadius,
                                                               new Vector2(X, Bounds.Top));
             for (var i = 0; i < m_chainLinksList.Count; i++)
             {
                 m_chainLinksList[i] = CDGMath.GetCirclePosition(m_ballAngle, num2, new Vector2(X, Bounds.Top));
                 num2 += m_chainLinkDistance;
             }
             num2 = 0f;
             if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
             {
                 BallAndChain2.Position = CDGMath.GetCirclePosition(m_ballAngle * ChainSpeed2Modifier,
                                                                    m_actualChainRadius / 2f, new Vector2(X, Bounds.Top));
             }
             else if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
             {
                 BallAndChain2.Position = CDGMath.GetCirclePosition(-m_ballAngle * ChainSpeed2Modifier,
                                                                    -m_actualChainRadius / 2f, new Vector2(X, Bounds.Top));
             }
             for (var j = 0; j < m_chainLinks2List.Count; j++)
             {
                 if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
                 {
                     m_chainLinks2List[j] = CDGMath.GetCirclePosition(m_ballAngle * ChainSpeed2Modifier, num2,
                                                                      new Vector2(X, Bounds.Top));
                 }
                 else if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
                 {
                     m_chainLinks2List[j] = CDGMath.GetCirclePosition(-m_ballAngle * ChainSpeed2Modifier, -num2,
                                                                      new Vector2(X, Bounds.Top));
                 }
                 num2 += m_chainLinkDistance;
             }
             m_ballAngle += ChainSpeed * 60f * num;
             if (!IsAnimating && CurrentSpeed != 0f)
             {
                 PlayAnimation();
             }
         }
         if (SpriteName == "EnemyFlailKnight_Character")
         {
             m_walkSound.Update();
             m_walkSound2.Update();
         }
     }
     base.Update(gameTime);
 }
コード例 #3
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);
        }
コード例 #4
0
 public override void Update(GameTime gameTime)
 {
     if (SpriteName == "EnemyMimicAttack_Character")
     {
         m_closeSound.Update();
     }
     base.Update(gameTime);
 }
コード例 #5
0
 public override void Update(GameTime gameTime)
 {
     if (SpriteName == "EnemySpearKnightWalk_Character")
     {
         m_walkSound.Update();
         m_walkSound2.Update();
     }
     base.Update(gameTime);
 }
コード例 #6
0
 public override void Update(GameTime gameTime)
 {
     if (m_lastBoss.SpriteName == "EnemyLastBossDeath_Character")
     {
         m_bossKneesSound.Update();
         m_bossFallSound.Update();
     }
     base.Update(gameTime);
 }
コード例 #7
0
 public override void Update(GameTime gameTime)
 {
     if (InputManager.JustPressed(Keys.Space, PlayerIndex.One))
     {
         (m_dialoguePlate.GetChildAt(2) as TextObj).Text =
             GameEV.GAME_HINTS[CDGMath.RandomInt(0, GameEV.GAME_HINTS.Length - 1)];
     }
     if (m_player.SpriteName == "PlayerDeath_Character")
     {
         m_playerFallSound.Update();
         m_playerSwordFallSound.Update();
         m_playerSwordSpinSound.Update();
     }
     base.Update(gameTime);
 }
コード例 #8
0
 public override void Update(GameTime gameTime)
 {
     if (m_startDelayCounter > 0f)
     {
         m_startDelayCounter -= (float)gameTime.ElapsedGameTime.TotalSeconds;
     }
     if (!m_isTouchingGround && IsWeighted && CurrentSpeed == 0f && SpriteName == "EnemyWargJump_Character")
     {
         CurrentSpeed = Speed;
     }
     base.Update(gameTime);
     if (m_isTouchingGround && CurrentSpeed == 0f && !IsAnimating)
     {
         ChangeSprite("EnemyWargIdle_Character");
         PlayAnimation();
     }
     if (SpriteName == "EnemyWargRun_Character")
     {
         m_runFrameSound.Update();
     }
 }
コード例 #9
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);
        }