Example #1
0
        public static EnemyObj BuildEnemy(int enemyType, PlayerObj player, PhysicsManager physicsManager,
                                          ProceduralLevelScreen levelToAttachTo, GameTypes.EnemyDifficulty difficulty, bool doNotInitialize = false)
        {
            EnemyObj enemyObj = null;

            switch (enemyType)
            {
            case 1:
                enemyObj = new EnemyObj_BallAndChain(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 2:
                enemyObj = new EnemyObj_Blob(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 3:
                enemyObj = new EnemyObj_BouncySpike(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 4:
                enemyObj = new EnemyObj_Eagle(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 5:
                enemyObj = new EnemyObj_EarthWizard(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 6:
                enemyObj = new EnemyObj_Eyeball(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 7:
                enemyObj = new EnemyObj_Fairy(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 8:
                enemyObj = new EnemyObj_Fireball(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 9:
                enemyObj = new EnemyObj_FireWizard(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 10:
                enemyObj = new EnemyObj_Horse(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 11:
                enemyObj = new EnemyObj_IceWizard(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 12:
                enemyObj = new EnemyObj_Knight(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 13:
                enemyObj = new EnemyObj_Ninja(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 14:
                enemyObj = new EnemyObj_ShieldKnight(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 15:
                enemyObj = new EnemyObj_Skeleton(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 16:
                enemyObj = new EnemyObj_SwordKnight(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 17:
                enemyObj = new EnemyObj_Turret(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 18:
                enemyObj = new EnemyObj_Wall(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 19:
                enemyObj = new EnemyObj_Wolf(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 20:
                enemyObj = new EnemyObj_Zombie(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 21:
                enemyObj = new EnemyObj_SpikeTrap(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 22:
                enemyObj = new EnemyObj_Plant(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 23:
                enemyObj = new EnemyObj_Energon(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 24:
                enemyObj = new EnemyObj_Spark(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 25:
                enemyObj = new EnemyObj_SkeletonArcher(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 26:
                enemyObj = new EnemyObj_Chicken(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 27:
                enemyObj = new EnemyObj_Platform(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 28:
                enemyObj = new EnemyObj_HomingTurret(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 29:
                enemyObj = new EnemyObj_LastBoss(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 30:
                enemyObj = new EnemyObj_Dummy(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 31:
                enemyObj = new EnemyObj_Starburst(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 32:
                enemyObj = new EnemyObj_Portrait(player, physicsManager, levelToAttachTo, difficulty);
                break;

            case 33:
                enemyObj = new EnemyObj_Mimic(player, physicsManager, levelToAttachTo, difficulty);
                break;
            }
            if (player == null && !doNotInitialize)
            {
                enemyObj.Initialize();
            }
            return(enemyObj);
        }
Example #2
0
        public void Break()
        {
            var player = Game.ScreenManager.Player;

            foreach (var current in _objectList)
            {
                current.Visible = true;
            }
            GoToFrame(2);
            Broken = true;
            m_internalIsWeighted = IsWeighted;
            IsWeighted           = false;
            IsCollidable         = false;
            if (DropItem)
            {
                var flag = false;
                if (Name == "Health")
                {
                    player.AttachedLevel.ItemDropManager.DropItem(Position, 2, 0.1f);
                    flag = true;
                }
                else if (Name == "Mana")
                {
                    player.AttachedLevel.ItemDropManager.DropItem(Position, 3, 0.1f);
                    flag = true;
                }
                if (flag)
                {
                    for (var i = 0; i < NumChildren; i++)
                    {
                        Tween.By(GetChildAt(i), 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y",
                                 "50", "Rotation", CDGMath.RandomInt(-360, 360).ToString());
                        Tween.To(GetChildAt(i), 0.1f, Linear.EaseNone, "delay", "0.2", "Opacity", "0");
                    }
                    SoundManager.Play3DSound(this, Game.ScreenManager.Player, "EnemyHit1", "EnemyHit2", "EnemyHit3",
                                             "EnemyHit4", "EnemyHit5", "EnemyHit6");
                    SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Break1", "Break2", "Break3");
                    if (Game.PlayerStats.Traits.X == 15f || Game.PlayerStats.Traits.Y == 15f)
                    {
                        player.CurrentMana += 1f;
                        player.AttachedLevel.TextManager.DisplayNumberStringText(1, "mp", Color.RoyalBlue,
                                                                                 new Vector2(player.X, player.Bounds.Top - 30));
                    }
                    return;
                }
                var num  = CDGMath.RandomInt(1, 100);
                var num2 = 0;
                var j    = 0;
                while (j < GameEV.BREAKABLE_ITEMDROP_CHANCE.Length)
                {
                    num2 += GameEV.BREAKABLE_ITEMDROP_CHANCE[j];
                    if (num <= num2)
                    {
                        if (j == 0)
                        {
                            if (Game.PlayerStats.Traits.X != 24f && Game.PlayerStats.Traits.Y != 24f)
                            {
                                player.AttachedLevel.ItemDropManager.DropItem(Position, 2, 0.1f);
                                break;
                            }
                            var enemyObj_Chicken = new EnemyObj_Chicken(null, null, null,
                                                                        GameTypes.EnemyDifficulty.BASIC);
                            enemyObj_Chicken.AccelerationY = -500f;
                            enemyObj_Chicken.Position      = Position;
                            enemyObj_Chicken.Y            -= 50f;
                            enemyObj_Chicken.SaveToFile    = false;
                            player.AttachedLevel.AddEnemyToCurrentRoom(enemyObj_Chicken);
                            enemyObj_Chicken.IsCollidable = false;
                            Tween.RunFunction(0.2f, enemyObj_Chicken, "MakeCollideable");
                            SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Chicken_Cluck_01",
                                                     "Chicken_Cluck_02", "Chicken_Cluck_03");
                            break;
                        }
                        if (j == 1)
                        {
                            player.AttachedLevel.ItemDropManager.DropItem(Position, 3, 0.1f);
                            break;
                        }
                        if (j == 2)
                        {
                            player.AttachedLevel.ItemDropManager.DropItem(Position, 1, 10f);
                            break;
                        }
                        if (j == 3)
                        {
                            player.AttachedLevel.ItemDropManager.DropItem(Position, 10, 100f);
                        }
                        break;
                    }
                    j++;
                }
            }
            for (var k = 0; k < NumChildren; k++)
            {
                Tween.By(GetChildAt(k), 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", "50",
                         "Rotation", CDGMath.RandomInt(-360, 360).ToString());
                Tween.To(GetChildAt(k), 0.1f, Linear.EaseNone, "delay", "0.2", "Opacity", "0");
            }
            SoundManager.Play3DSound(this, Game.ScreenManager.Player, "EnemyHit1", "EnemyHit2", "EnemyHit3", "EnemyHit4",
                                     "EnemyHit5", "EnemyHit6");
            SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Break1", "Break2", "Break3");
            if (Game.PlayerStats.Traits.X == 15f || Game.PlayerStats.Traits.Y == 15f)
            {
                player.CurrentMana += 1f;
                player.AttachedLevel.TextManager.DisplayNumberStringText(1, "mp", Color.RoyalBlue,
                                                                         new Vector2(player.X, player.Bounds.Top - 30));
            }
        }
Example #3
0
 public void Break()
 {
     PlayerObj player = Game.ScreenManager.Player;
     foreach (GameObj current in this._objectList)
     {
         current.Visible = true;
     }
     base.GoToFrame(2);
     this.Broken = true;
     this.m_internalIsWeighted = base.IsWeighted;
     base.IsWeighted = false;
     base.IsCollidable = false;
     if (this.DropItem)
     {
         bool flag = false;
         if (base.Name == "Health")
         {
             player.AttachedLevel.ItemDropManager.DropItem(base.Position, 2, 0.1f);
             flag = true;
         }
         else if (base.Name == "Mana")
         {
             player.AttachedLevel.ItemDropManager.DropItem(base.Position, 3, 0.1f);
             flag = true;
         }
         if (flag)
         {
             for (int i = 0; i < base.NumChildren; i++)
             {
                 Tween.By(base.GetChildAt(i), 0.3f, new Easing(Linear.EaseNone), new string[]
                 {
                     "X",
                     CDGMath.RandomInt(-50, 50).ToString(),
                     "Y",
                     "50",
                     "Rotation",
                     CDGMath.RandomInt(-360, 360).ToString()
                 });
                 Tween.To(base.GetChildAt(i), 0.1f, new Easing(Linear.EaseNone), new string[]
                 {
                     "delay",
                     "0.2",
                     "Opacity",
                     "0"
                 });
             }
             SoundManager.Play3DSound(this, Game.ScreenManager.Player, new string[]
             {
                 "EnemyHit1",
                 "EnemyHit2",
                 "EnemyHit3",
                 "EnemyHit4",
                 "EnemyHit5",
                 "EnemyHit6"
             });
             SoundManager.Play3DSound(this, Game.ScreenManager.Player, new string[]
             {
                 "Break1",
                 "Break2",
                 "Break3"
             });
             if (Game.PlayerStats.Traits.X == 15f || Game.PlayerStats.Traits.Y == 15f)
             {
                 player.CurrentMana += 1f;
                 player.AttachedLevel.TextManager.DisplayNumberStringText(1, "mp", Color.RoyalBlue, new Vector2(player.X, (float)(player.Bounds.Top - 30)));
             }
             return;
         }
         int num = CDGMath.RandomInt(1, 100);
         int num2 = 0;
         int j = 0;
         while (j < GameEV.BREAKABLE_ITEMDROP_CHANCE.Length)
         {
             num2 += GameEV.BREAKABLE_ITEMDROP_CHANCE[j];
             if (num <= num2)
             {
                 if (j == 0)
                 {
                     if (Game.PlayerStats.Traits.X != 24f && Game.PlayerStats.Traits.Y != 24f)
                     {
                         player.AttachedLevel.ItemDropManager.DropItem(base.Position, 2, 0.1f);
                         break;
                     }
                     EnemyObj_Chicken enemyObj_Chicken = new EnemyObj_Chicken(null, null, null, GameTypes.EnemyDifficulty.BASIC);
                     enemyObj_Chicken.AccelerationY = -500f;
                     enemyObj_Chicken.Position = base.Position;
                     enemyObj_Chicken.Y -= 50f;
                     enemyObj_Chicken.SaveToFile = false;
                     player.AttachedLevel.AddEnemyToCurrentRoom(enemyObj_Chicken);
                     enemyObj_Chicken.IsCollidable = false;
                     Tween.RunFunction(0.2f, enemyObj_Chicken, "MakeCollideable", new object[0]);
                     SoundManager.Play3DSound(this, Game.ScreenManager.Player, new string[]
                     {
                         "Chicken_Cluck_01",
                         "Chicken_Cluck_02",
                         "Chicken_Cluck_03"
                     });
                     break;
                 }
                 else
                 {
                     if (j == 1)
                     {
                         player.AttachedLevel.ItemDropManager.DropItem(base.Position, 3, 0.1f);
                         break;
                     }
                     if (j == 2)
                     {
                         player.AttachedLevel.ItemDropManager.DropItem(base.Position, 1, 10f);
                         break;
                     }
                     if (j == 3)
                     {
                         player.AttachedLevel.ItemDropManager.DropItem(base.Position, 10, 100f);
                         break;
                     }
                     break;
                 }
             }
             else
             {
                 j++;
             }
         }
     }
     for (int k = 0; k < base.NumChildren; k++)
     {
         Tween.By(base.GetChildAt(k), 0.3f, new Easing(Linear.EaseNone), new string[]
         {
             "X",
             CDGMath.RandomInt(-50, 50).ToString(),
             "Y",
             "50",
             "Rotation",
             CDGMath.RandomInt(-360, 360).ToString()
         });
         Tween.To(base.GetChildAt(k), 0.1f, new Easing(Linear.EaseNone), new string[]
         {
             "delay",
             "0.2",
             "Opacity",
             "0"
         });
     }
     SoundManager.Play3DSound(this, Game.ScreenManager.Player, new string[]
     {
         "EnemyHit1",
         "EnemyHit2",
         "EnemyHit3",
         "EnemyHit4",
         "EnemyHit5",
         "EnemyHit6"
     });
     SoundManager.Play3DSound(this, Game.ScreenManager.Player, new string[]
     {
         "Break1",
         "Break2",
         "Break3"
     });
     if (Game.PlayerStats.Traits.X == 15f || Game.PlayerStats.Traits.Y == 15f)
     {
         player.CurrentMana += 1f;
         player.AttachedLevel.TextManager.DisplayNumberStringText(1, "mp", Color.RoyalBlue, new Vector2(player.X, (float)(player.Bounds.Top - 30)));
     }
 }
Example #4
0
 public static EnemyObj BuildEnemy(int enemyType, PlayerObj player, PhysicsManager physicsManager, ProceduralLevelScreen levelToAttachTo, GameTypes.EnemyDifficulty difficulty, bool doNotInitialize = false)
 {
     EnemyObj enemyObj = null;
     switch (enemyType)
     {
     case 1:
         enemyObj = new EnemyObj_BallAndChain(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 2:
         enemyObj = new EnemyObj_Blob(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 3:
         enemyObj = new EnemyObj_BouncySpike(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 4:
         enemyObj = new EnemyObj_Eagle(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 5:
         enemyObj = new EnemyObj_EarthWizard(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 6:
         enemyObj = new EnemyObj_Eyeball(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 7:
         enemyObj = new EnemyObj_Fairy(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 8:
         enemyObj = new EnemyObj_Fireball(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 9:
         enemyObj = new EnemyObj_FireWizard(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 10:
         enemyObj = new EnemyObj_Horse(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 11:
         enemyObj = new EnemyObj_IceWizard(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 12:
         enemyObj = new EnemyObj_Knight(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 13:
         enemyObj = new EnemyObj_Ninja(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 14:
         enemyObj = new EnemyObj_ShieldKnight(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 15:
         enemyObj = new EnemyObj_Skeleton(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 16:
         enemyObj = new EnemyObj_SwordKnight(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 17:
         enemyObj = new EnemyObj_Turret(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 18:
         enemyObj = new EnemyObj_Wall(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 19:
         enemyObj = new EnemyObj_Wolf(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 20:
         enemyObj = new EnemyObj_Zombie(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 21:
         enemyObj = new EnemyObj_SpikeTrap(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 22:
         enemyObj = new EnemyObj_Plant(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 23:
         enemyObj = new EnemyObj_Energon(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 24:
         enemyObj = new EnemyObj_Spark(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 25:
         enemyObj = new EnemyObj_SkeletonArcher(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 26:
         enemyObj = new EnemyObj_Chicken(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 27:
         enemyObj = new EnemyObj_Platform(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 28:
         enemyObj = new EnemyObj_HomingTurret(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 29:
         enemyObj = new EnemyObj_LastBoss(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 30:
         enemyObj = new EnemyObj_Dummy(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 31:
         enemyObj = new EnemyObj_Starburst(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 32:
         enemyObj = new EnemyObj_Portrait(player, physicsManager, levelToAttachTo, difficulty);
         break;
     case 33:
         enemyObj = new EnemyObj_Mimic(player, physicsManager, levelToAttachTo, difficulty);
         break;
     }
     if (player == null && !doNotInitialize)
     {
         enemyObj.Initialize();
     }
     return enemyObj;
 }