Ejemplo n.º 1
0
        public override void Initialize()
        {
            foreach (var current in EnemyList)
            {
                if (current is EnemyObj_Fireball)
                {
                    m_boss = (current as EnemyObj_Fireball);
                }
                current.Visible = false;
                current.PauseEnemy(true);
            }
            m_boss.ChangeSprite("EnemyGhostBossIdle_Character");
            m_bossStartingScale = m_boss.ScaleX;
            m_fireList          = new List <SpriteObj>();
            var num  = 0f;
            var num2 = 24f;

            for (var i = 0; i < 15; i++)
            {
                var spriteObj = new SpriteObj("GhostBossProjectile_Sprite");
                spriteObj.PlayAnimation();
                spriteObj.OutlineWidth = 2;
                spriteObj.Position     = CDGMath.GetCirclePosition(num, 300f, m_boss.Position);
                spriteObj.Scale        = new Vector2(2f, 2f);
                num += num2;
                spriteObj.Opacity = 0f;
                m_fireList.Add(spriteObj);
                GameObjList.Add(spriteObj);
            }
            base.Initialize();
        }
Ejemplo n.º 2
0
        public override void Update(ProjectileObj proj, GameTime gameTime)
        {
            base.Update(proj, gameTime);

            proj.AltX    += proj.CurrentSpeed * 60f * (float)gameTime.ElapsedGameTime.TotalSeconds;
            proj.Position = CDGMath.GetCirclePosition(proj.AltX, proj.AltY, proj.Target.Position);
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
        protected override EffectSpriteInstance CreateSprite(Vector2 position)
        {
            var sprite = base.CreateSprite(position);

            sprite.Position = CDGMath.GetCirclePosition(sprite.Rotation - 90f, 20f, sprite.Position);

            return(sprite);
        }
Ejemplo n.º 5
0
        public static ProjectileObj Fire(GameObj source, float angle, float distance)
        {
            var proj = Instance.Fire(source);

            proj.IgnoreBoundsCheck = true;
            proj.CollisionType     = Game.CollisionType.Wall;
            proj.Orientation       = MathHelper.ToRadians(angle);
            proj.Position          = CDGMath.GetCirclePosition(angle, distance, source.Position);

            return(proj);
        }
Ejemplo n.º 6
0
        public override void ResetState()
        {
            base.ResetState();
            m_actualChainRadius = 0f;
            m_chainLinkDistance = m_actualChainRadius / m_numChainLinks;
            var num = 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, num, new Vector2(X, Bounds.Top));
                num += m_chainLinkDistance;
            }
            num = 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, num,
                                                                     new Vector2(X, Bounds.Top));
                }
                else if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
                {
                    m_chainLinks2List[j] = CDGMath.GetCirclePosition(-m_ballAngle * ChainSpeed2Modifier, -num,
                                                                     new Vector2(X, Bounds.Top));
                }
                num += m_chainLinkDistance;
            }
        }
Ejemplo n.º 7
0
        public void Update(GameTime gameTime)
        {
            if (!IsPaused)
            {
                var num   = (float)gameTime.ElapsedGameTime.TotalSeconds;
                var spell = Spell;
                switch (spell)
                {
                case 3:
                    if (BlinkTime >= AltX && AltX != 0f)
                    {
                        Blink(Color.Red, 0.1f);
                        BlinkTime = AltX / 1.5f;
                    }
                    if (AltX > 0f)
                    {
                        AltX -= num;
                        if (AltX <= 0f)
                        {
                            ActivateEffect();
                        }
                    }
                    break;

                case 4:
                    break;

                case 5:
                    if (AltY > 0f)
                    {
                        AltY -= num;
                        if (AltY <= 0f)
                        {
                            var proceduralLevelScreen =
                                Game.ScreenManager.CurrentScreen as ProceduralLevelScreen;
                            if (proceduralLevelScreen != null)
                            {
                                proceduralLevelScreen.ImpactEffectPool.CrowSmokeEffect(Position);
                                AltY = 0.05f;
                            }
                        }
                    }
                    if (AltX <= 0f)
                    {
                        var position = Target.Position;
                        TurnToFace(position, TurnSpeed, num);
                    }
                    else
                    {
                        AltX       -= num;
                        Orientation = MathHelper.WrapAngle(Orientation);
                    }
                    HeadingX      = (float)Math.Cos(Orientation);
                    HeadingY      = (float)Math.Sin(Orientation);
                    AccelerationX = 0f;
                    AccelerationY = 0f;
                    Position     += Heading * (CurrentSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds);
                    if (HeadingX > 0f)
                    {
                        Flip     = SpriteEffects.None;
                        Rotation = MathHelper.ToDegrees(Orientation);
                    }
                    else
                    {
                        Flip = SpriteEffects.FlipHorizontally;
                        var num2 = MathHelper.ToDegrees(Orientation);
                        if (num2 < 0f)
                        {
                            Rotation = (180f + num2) * 60f * num;
                        }
                        else
                        {
                            Rotation = (-180f + num2) * 60f * num;
                        }
                    }
                    Rotation = MathHelper.Clamp(Rotation, -90f, 90f);
                    if (Target != null)
                    {
                        var enemyObj = Target as EnemyObj;
                        if (enemyObj != null && enemyObj.IsKilled)
                        {
                            RunDestroyAnimation(false);
                        }
                    }
                    else
                    {
                        RunDestroyAnimation(false);
                    }
                    break;

                default:
                    switch (spell)
                    {
                    case 8:
                        AccelerationX -= AltX * 60f * num;
                        if (AltY > 0f)
                        {
                            AltY -= num;
                            if (AltY <= 0f)
                            {
                                ActivateEffect();
                            }
                        }
                        break;

                    case 9:
                    case 10:
                        break;

                    case 11:
                    {
                        var player = Game.ScreenManager.Player;
                        if (player.CastingDamageShield || Source is EnemyObj)
                        {
                            AltX    += CurrentSpeed * 60f * num;
                            Position = CDGMath.GetCirclePosition(AltX, AltY, Target.Position);
                        }
                        else
                        {
                            KillProjectile();
                        }
                        break;
                    }

                    case 12:
                        AccelerationX = 0f;
                        AccelerationY = 0f;
                        HeadingX      = (float)Math.Cos(Orientation);
                        HeadingY      = (float)Math.Sin(Orientation);
                        Position     += Heading * (CurrentSpeed * num);
                        if (AltY > 0f)
                        {
                            AltY -= num;
                            if (AltY <= 0f)
                            {
                                ActivateEffect();
                            }
                        }
                        break;

                    default:
                        if (spell == 100)
                        {
                            if (AltX > 0f)
                            {
                                AltX   -= num;
                                Opacity = 0.9f - AltX;
                                ScaleY  = 1f - AltX;
                                if (AltX <= 0f)
                                {
                                    ActivateEffect();
                                }
                            }
                        }
                        break;
                    }
                    break;
                }
                if (ChaseTarget && Target != null)
                {
                    var position2 = Target.Position;
                    TurnToFace(position2, TurnSpeed, num);
                    HeadingX      = (float)Math.Cos(Orientation);
                    HeadingY      = (float)Math.Sin(Orientation);
                    AccelerationX = 0f;
                    AccelerationY = 0f;
                    Position     += Heading * (CurrentSpeed * num);
                    Rotation      = MathHelper.ToDegrees(Orientation);
                }
                if (FollowArc && !ChaseTarget && !IsDying)
                {
                    var radians = (float)Math.Atan2(AccelerationY, AccelerationX);
                    Rotation = MathHelper.ToDegrees(radians);
                }
                else if (!ChaseTarget)
                {
                    Rotation += RotationSpeed * 60f * num;
                }
                m_elapsedLifeSpan += num;
                if (m_elapsedLifeSpan >= LifeSpan)
                {
                    IsAlive = false;
                }
                if (m_blinkTimer > 0f)
                {
                    m_blinkTimer -= num;
                    TextureColor  = m_blinkColour;
                    return;
                }
                if (TextureColor == m_blinkColour)
                {
                    TextureColor = Color.White;
                }
            }
        }