示例#1
0
        public void Update(GameTime gameTime, Vector2 playerposition, Player player, int currentSpieler, ParticleManager particleManager, AbilityManager abilities, Game1 game)
        {
            #region InteractiveObjects
            for (int i = 0; i < lstDynamit.Count; i++)
            {
                lstDynamit[i].Update(gameTime);

                if (lstDynamit[i].Explosion && !lstDynamit[i].Exploded)
                {
                    int x = 0, y = 0, r = 100;

                    for (int w = 0; w < 360; w += 10)
                    {
                        x = Convert.ToInt32(32 + lstDynamit[i].Position.X + r * Math.Sin(w * (Math.PI / 180)));
                        y = Convert.ToInt32(32 + lstDynamit[i].Position.Y + r * Math.Cos(w * (Math.PI / 180)));
                        lstDynamitArrowTrapBullets.Add(new ShotAnimation(new Vector2(x, y), lstDynamit[i].Position + new Vector2(32, 32), 2f, dynamitbullet, 10, 5, 30, 30, new Vector2(30, 30), 4, ""));
                    }

                    lstDynamit[i].Exploded  = true;//Damit sich das Dynamit nur einmal entzündet
                    lstDynamit[i].Explosion = false;
                }
            }

            for (int i = 0; i < lstArrowTrap.Count; i++)
            {
                lstArrowTrap[i].Update(gameTime);

                if (lstArrowTrap[i].Cooldown >= 1.0f)
                {
                    if (lstArrowTrap[i].Direction == 0)
                    {
                        lstDynamitArrowTrapBullets.Add(new ShotStandard(lstArrowTrap[i].Position + new Vector2(32, -32), lstArrowTrap[i].Position + new Vector2(32, 32), 2f, arrow, new Vector2(32, 10), 10, ""));
                    }
                    else if (lstArrowTrap[i].Direction == 1)
                    {
                        lstDynamitArrowTrapBullets.Add(new ShotStandard(lstArrowTrap[i].Position + new Vector2(32, 32), lstArrowTrap[i].Position + new Vector2(31, 32), 2f, arrow, new Vector2(32, 10), 10, ""));
                    }
                    else if (lstArrowTrap[i].Direction == 2)
                    {
                        lstDynamitArrowTrapBullets.Add(new ShotStandard(lstArrowTrap[i].Position + new Vector2(32, 33), lstArrowTrap[i].Position + new Vector2(32, 32), 2f, arrow, new Vector2(32, 10), 10, ""));
                    }
                    else
                    {
                        lstDynamitArrowTrapBullets.Add(new ShotStandard(lstArrowTrap[i].Position + new Vector2(-32, 32), lstArrowTrap[i].Position + new Vector2(32, 32), 2f, arrow, new Vector2(32, 10), 10, ""));
                    }

                    lstArrowTrap[i].Cooldown = 0f;
                }
            }

            for (int i = 0; i < lstChest.Count; i++)
            {
                lstChest[i].Update(gameTime);

                if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstChest[i].Position.X - 50, (int)lstChest[i].Position.Y - 50, 32 + 100, 32 + 100)) && !lstChest[i].Opened)
                {                              //Wenn Spieler mit Chest Kollidiert
                    lstChest[i].Opened = true; //Damit sich die Chest nur einmal öffnen lässt
                    SpawnChestItem(lstChest[i].Position);
                }
            }

            for (int i = 0; i < lstTrap.Count; i++)
            {
                lstTrap[i].Update(gameTime);

                if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstTrap[i].Position.X, (int)lstTrap[i].Position.Y, 64, 64)) && lstTrap[i].Cooldown >= 0.5f) //Alle 0.5 sec
                {                                                                                                                                                                                                 //Wenn Spieler mit Falle Kollidiert
                    player.LebenAbziehen(10, currentSpieler, particleManager, playerposition, game);                                                                                                              //10 hp abziehen
                    //particleManager.SpawnHitParticle(playerposition, -10, new Color(255, 0, 64));
                    lstTrap[i].Cooldown = 0f;
                }
            }

            for (int i = 0; i < lstDynamitArrowTrapBullets.Count; i++)
            {
                lstDynamitArrowTrapBullets[i].Update(gameTime);
            }

            #endregion

            #region PickUpItems
            for (int i = 0; i < lstCoin.Count; i++)
            {
                if (lstCoin[i].Collected)                     //Wenn vom Spieler eingesammelt
                {
                    lstCoin[i].Update(new Vector2(1820, 40)); //Ziel zu Coin HUD Position änderen

                    if (new Rectangle(1820, 40, 30, 30).Intersects(new Rectangle((int)lstCoin[i].ItemPosition.X, (int)lstCoin[i].ItemPosition.Y, (int)lstCoin[i].ItemSize.X, (int)lstCoin[i].ItemSize.Y)))
                    {
                        player.Coin += 1;                                                                    //Coin + 1
                        particleManager.SpawnHitParticle(new Vector2(1825, 40), 1, new Color(238, 190, 46)); //Partikel erzeugen
                        lstCoin.RemoveAt(i);                                                                 //Coin entfernen
                    }
                }
                else
                {
                    lstCoin[i].Update(playerposition);
                    if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstCoin[i].ItemPosition.X, (int)lstCoin[i].ItemPosition.Y, (int)lstCoin[i].ItemSize.X, (int)lstCoin[i].ItemSize.Y)))
                    {//Wenn Spieler mit Item Kollidiert
                        lstCoin[i].Radius = 2000;
                        lstCoin[i].Speed  = 25;

                        lstCoin[i].Collected = true;
                    }
                }
            }

            for (int i = 0; i < lstExperience.Count; i++)
            {
                if (lstExperience[i].Collected)
                {
                    lstExperience[i].Update(new Vector2(875, 970));

                    if (new Rectangle(810, 970, 128, 128).Intersects(new Rectangle((int)lstExperience[i].ItemPosition.X, (int)lstExperience[i].ItemPosition.Y, (int)lstExperience[i].ItemSize.X, (int)lstExperience[i].ItemSize.Y)))
                    {
                        particleManager.SpawnHitParticle(new Vector2(865, 970), 10, new Color(211, 252, 126));
                        player.XpHinzufügen(10, currentSpieler); //10 xp hinzufügen
                        lstExperience.RemoveAt(i);               //Xp entfernen
                    }
                }
                else
                {
                    lstExperience[i].Update(playerposition);
                    if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstExperience[i].ItemPosition.X, (int)lstExperience[i].ItemPosition.Y, (int)lstExperience[i].ItemSize.X, (int)lstExperience[i].ItemSize.Y)))
                    {//Wenn Spieler mit Item Kollidiert
                        lstExperience[i].Radius = 2000;
                        lstExperience[i].Speed  = 25;

                        lstExperience[i].Collected = true;
                    }
                }
            }

            for (int i = 0; i < lstHealthPotionSmall.Count; i++)
            {
                if (lstHealthPotionSmall[i].Collected)
                {
                    lstHealthPotionSmall[i].Update(new Vector2(865, 1010));

                    if (new Rectangle(810, 1010, 128, 128).Intersects(new Rectangle((int)lstHealthPotionSmall[i].ItemPosition.X, (int)lstHealthPotionSmall[i].ItemPosition.Y, (int)lstHealthPotionSmall[i].ItemSize.X, (int)lstHealthPotionSmall[i].ItemSize.Y)))
                    {
                        particleManager.SpawnHitParticle(new Vector2(865, 1010), 50, new Color(255, 0, 64));
                        lstHealthPotionSmall.RemoveAt(i);//Xp entfernen
                    }
                }
                else
                {
                    lstHealthPotionSmall[i].Update(playerposition);
                    if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstHealthPotionSmall[i].ItemPosition.X, (int)lstHealthPotionSmall[i].ItemPosition.Y, (int)lstHealthPotionSmall[i].ItemSize.X, (int)lstHealthPotionSmall[i].ItemSize.Y)))
                    {//Wenn Spieler mit Item Kollidiert
                        lstHealthPotionSmall[i].Radius = 2000;
                        lstHealthPotionSmall[i].Speed  = 25;
                        player.LebenHinzufügen(50, currentSpieler);//50 hp hinzufügen

                        lstHealthPotionSmall[i].Collected = true;
                    }
                }
            }

            for (int i = 0; i < lstHealthPotionBig.Count; i++)
            {
                if (lstHealthPotionBig[i].Collected)
                {
                    lstHealthPotionBig[i].Update(new Vector2(865, 1010));

                    if (new Rectangle(810, 1010, 128, 128).Intersects(new Rectangle((int)lstHealthPotionBig[i].ItemPosition.X, (int)lstHealthPotionBig[i].ItemPosition.Y, (int)lstHealthPotionBig[i].ItemSize.X, (int)lstHealthPotionBig[i].ItemSize.Y)))
                    {
                        particleManager.SpawnHitParticle(new Vector2(855, 1010), 100, new Color(255, 0, 64));
                        lstHealthPotionBig.RemoveAt(i);//Xp entfernen
                    }
                }
                else
                {
                    lstHealthPotionBig[i].Update(playerposition);
                    if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstHealthPotionBig[i].ItemPosition.X, (int)lstHealthPotionBig[i].ItemPosition.Y, (int)lstHealthPotionBig[i].ItemSize.X, (int)lstHealthPotionBig[i].ItemSize.Y)))
                    {//Wenn Spieler mit Item Kollidiert
                        lstHealthPotionBig[i].Radius = 2000;
                        lstHealthPotionBig[i].Speed  = 25;
                        player.LebenHinzufügen(100, currentSpieler);//100 hp hinzufügen

                        lstHealthPotionBig[i].Collected = true;
                    }
                }
            }

            for (int i = 0; i < lstHourglass.Count; i++)
            {
                if (lstHourglass[i].Collected)
                {
                    lstHourglass[i].Update(new Vector2(865, 1010));

                    if (new Rectangle(810, 1010, 128, 128).Intersects(new Rectangle((int)lstHourglass[i].ItemPosition.X, (int)lstHourglass[i].ItemPosition.Y, (int)lstHourglass[i].ItemSize.X, (int)lstHourglass[i].ItemSize.Y)))
                    {
                        particleManager.SpawnHitParticle(new Vector2(855, 1010), 100, new Color(192, 192, 192));
                        lstHourglass.RemoveAt(i);
                    }
                }
                else
                {
                    lstHourglass[i].Update(playerposition);
                    if (new Rectangle((int)playerposition.X, (int)playerposition.Y, 32, 48).Intersects(new Rectangle((int)lstHourglass[i].ItemPosition.X, (int)lstHourglass[i].ItemPosition.Y, (int)lstHourglass[i].ItemSize.X, (int)lstHourglass[i].ItemSize.Y)))
                    {//Wenn Spieler mit Item Kollidiert
                        lstHourglass[i].Radius = 2000;
                        lstHourglass[i].Speed  = 25;


                        //Abilities Cooldown Reset

                        abilities.CooldownAutoAttackArcher = abilities.MaxCooldownAutoAttackArcher;
                        abilities.CooldownAbility1Archer   = abilities.MaxCooldownAbility1Archer;
                        abilities.CooldownAbility2Archer   = abilities.MaxCooldownAbility1Archer;
                        abilities.CooldownAbility3Archer   = abilities.MaxCooldownAbility1Archer;
                        abilities.CooldownSpecialArcher    = abilities.MaxCooldownSpecialArcher;

                        abilities.CooldownAutoAttackWizard = abilities.MaxCooldownAutoAttackWizard;
                        abilities.CooldownAbility1Wizard   = abilities.MaxCooldownAbility1Wizard;
                        abilities.CooldownAbility2Wizard   = abilities.MaxCooldownAbility2Wizard;
                        abilities.CooldownAbility3Wizard   = abilities.MaxCooldownAbility3Wizard;
                        abilities.CooldownSpecialWizard    = abilities.MaxCooldownSpecialWizard;

                        abilities.CooldownAutoAttackKnight = abilities.MaxCooldownAutoAttackKnight;
                        abilities.CooldownAbility1Knight   = abilities.MaxCooldownAbility1Knight;
                        abilities.CooldownAbility2Knight   = abilities.MaxCooldownAbility2Knight;
                        abilities.CooldownAbility3Knight   = abilities.MaxCooldownAbility3Knight;
                        abilities.CooldownSpecialKnight    = abilities.MaxCooldownSpecialKnight;


                        lstHourglass[i].Collected = true;
                    }
                }
            }
            #endregion
        }
示例#2
0
        public void DrawHUD(SpriteBatch spriteBatch, GameTime gameTime, Vector2 mouseposition, int currentSpieler, AbilityManager abilityManager, Player _player)
        {
            if (currentSpieler == 0)
            {
                if (_player.LvlArcher >= 2)//Freigeschaltet ab lvl 2
                {
                    drawAbility(ability1Archer, new Vector2(950, 965), spriteBatch, abilityManager.CooldownAbility1Archer, abilityManager.MaxCooldownAbility1Archer);

                    if (_player.ArcherAbility1lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility1lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility1lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(990, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(950, 975), Color.White);
                }


                if (_player.LvlArcher >= 4)//Freigeschaltet ab lvl 4
                {
                    drawAbility(ability2Archer, new Vector2(1030, 965), spriteBatch, abilityManager.CooldownAbility2Archer, abilityManager.MaxCooldownAbility2Archer);

                    if (_player.ArcherAbility2lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility2lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility2lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1070, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1030, 975), Color.White);
                }


                if (_player.LvlArcher >= 6)//Freigeschaltet ab lvl 6
                {
                    drawAbility(ability3Archer, new Vector2(1110, 965), spriteBatch, abilityManager.CooldownAbility3Archer, abilityManager.MaxCooldownAbility3Archer);

                    if (_player.ArcherAbility3lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility3lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                    }
                    else if (_player.ArcherAbility3lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1150, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1110, 975), Color.White);
                }

                drawhpBar(new Vector2(810, 1010), spriteBatch, _player.HpArcher, _player.HpArcherMax);
                drawxpbar(new Vector2(810, 970), spriteBatch, _player.XpArcher, _player.XpArcherMax);

                spriteBatch.DrawString(font, Convert.ToString(_player.XpArcher), new Vector2(865, 975), Color.Green);
                spriteBatch.Draw(headArcher, new Rectangle(690, 950, 100, 100), Color.White);
                spriteBatch.DrawString(font, Convert.ToString(_player.LvlArcher), new Vector2(765, 990), Color.Black);
            }
            else if (currentSpieler == 1)
            {
                if (_player.LvlWizard >= 2)//Freigeschaltet ab lvl 2
                {
                    drawAbility(ability1Wizard, new Vector2(950, 965), spriteBatch, abilityManager.CooldownAbility1Wizard, abilityManager.MaxCooldownAbility1Wizard);

                    if (_player.WizardAbility1lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                    }
                    else if (_player.WizardAbility1lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                    }
                    else if (_player.WizardAbility1lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(990, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(950, 975), Color.White);
                }

                if (_player.LvlWizard >= 4)//Freigeschaltet ab lvl 4
                {
                    drawAbility(ability2Wizard, new Vector2(1030, 965), spriteBatch, abilityManager.CooldownAbility2Wizard, abilityManager.MaxCooldownAbility2Wizard);

                    if (_player.WizardAbility2lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                    }
                    else if (_player.WizardAbility2lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                    }
                    else if (_player.WizardAbility2lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1070, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1030, 975), Color.White);
                }

                if (_player.LvlWizard >= 6)//Freigeschaltet ab lvl 6
                {
                    drawAbility(ability3Wizard, new Vector2(1110, 965), spriteBatch, abilityManager.CooldownAbility3Wizard, abilityManager.MaxCooldownAbility3Wizard);

                    if (_player.WizardAbility3lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                    }
                    else if (_player.WizardAbility3lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                    }
                    else if (_player.WizardAbility3lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1150, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1110, 975), Color.White);
                }

                drawhpBar(new Vector2(810, 1010), spriteBatch, _player.HpWizard, _player.HpWizardMax);
                drawxpbar(new Vector2(810, 970), spriteBatch, _player.XpWizard, _player.XpWizardMax);

                spriteBatch.DrawString(font, Convert.ToString(_player.XpWizard), new Vector2(865, 975), Color.Green);
                spriteBatch.Draw(headWizard, new Rectangle(690, 950, 100, 100), Color.White);
                spriteBatch.DrawString(font, Convert.ToString(_player.LvlWizard), new Vector2(740, 1020), Color.White);
            }
            else if (currentSpieler == 2)
            {
                if (_player.LvlKnight >= 2)//Freigeschaltet ab lvl 2
                {
                    drawAbility(ability1Knight, new Vector2(950, 965), spriteBatch, abilityManager.CooldownAbility1Knight, abilityManager.MaxCooldownAbility1Knight);

                    if (_player.KnightAbility1lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                    }
                    else if (_player.KnightAbility1lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                    }
                    else if (_player.KnightAbility1lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(950, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(970, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(990, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(950, 975), Color.White);
                }

                if (_player.LvlKnight >= 4)//Freigeschaltet ab lvl 4
                {
                    drawAbility(ability2Knight, new Vector2(1030, 965), spriteBatch, abilityManager.CooldownAbility2Knight, abilityManager.MaxCooldownAbility2Knight);

                    if (_player.KnightAbility2lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                    }
                    else if (_player.KnightAbility2lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                    }
                    else if (_player.KnightAbility2lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1030, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1050, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1070, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1030, 975), Color.White);
                }

                if (_player.LvlKnight >= 6)//Freigeschaltet ab lvl 6
                {
                    drawAbility(ability3Knight, new Vector2(1110, 965), spriteBatch, abilityManager.CooldownAbility3Knight, abilityManager.MaxCooldownAbility3Knight);

                    if (_player.KnightAbility3lvl == 1)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                    }
                    else if (_player.KnightAbility3lvl == 2)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                    }
                    else if (_player.KnightAbility3lvl == 3)
                    {
                        spriteBatch.Draw(abilityLevel, new Vector2(1110, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1130, 1030), Color.White);
                        spriteBatch.Draw(abilityLevel, new Vector2(1150, 1030), Color.White);
                    }
                }
                else
                {
                    spriteBatch.Draw(abilitylocked, new Vector2(1110, 975), Color.White);
                }

                drawhpBar(new Vector2(810, 1010), spriteBatch, _player.HpKnight, _player.HpKnightMax);
                drawxpbar(new Vector2(810, 970), spriteBatch, _player.XpKnight, _player.XpKnightMax);

                spriteBatch.DrawString(font, Convert.ToString(_player.XpKnight), new Vector2(865, 975), Color.Green);
                spriteBatch.Draw(headKnight, new Vector2(690, 930), Color.White);
                spriteBatch.DrawString(font, Convert.ToString(_player.LvlKnight), new Vector2(740, 1020), Color.White);
            }

            animations.drawanimation(coin, new Vector2(1820, 40), spriteBatch, animations.getanimation(gameTime, 8, 4), 30, 30);
            spriteBatch.DrawString(font, Convert.ToString(_player.Coin), new Vector2(1850, 45), Color.Black);
        }
示例#3
0
        public void UpdateBulletCollision(GameTime gameTime, AbilityManager abilityManager, ObjectManager objectManager, Collision collision, ParticleManager particleManager, EnemyManager enemyManager, Movement movement, int currentSpieler, Player _player, Game1 game)
        {
            for (int i = 0; i < abilityManager.lstAbility.Count || i < enemyManager.lstGegnerShot.Count || i < objectManager.lstDynamitArrowTrapBullets.Count; i++) //Wenn sich ein Objekt in einer der Listen befindet
            {
                if (i < abilityManager.lstAbility.Count)                                                                                                            //Spieler Schüsse
                {
                    abilityManager.lstAbility[i].Update(gameTime);

                    if (abilityManager.lstAbility[i].ShotXY.X > 1920 || abilityManager.lstAbility[i].ShotXY.Y > 1080 ||
                        abilityManager.lstAbility[i].ShotXY.X < 0 || abilityManager.lstAbility[i].ShotXY.Y <0 || abilityManager.lstAbility[i].CurrentTime> 10f ||
                        collision.BulletCollision(new Vector2(Convert.ToInt32(abilityManager.lstAbility[i].ShotXY.X), Convert.ToInt32(abilityManager.lstAbility[i].ShotXY.Y)), (int)abilityManager.lstAbility[i].ShotSize.Y, (int)abilityManager.lstAbility[i].ShotSize.X, abilityManager.lstAbility[i].Rotation))
                    {
                        particleManager.SpawnStandardParticle(abilityManager.lstAbility[i].ShotXY - abilityManager.lstAbility[i].ShotSize / 2);
                        abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);//lstAbility entfernen
                        continue;
                    }

                    for (int j = 0; j < objectManager.lstDynamit.Count; j++)
                    {
                        if (new Rectangle((int)abilityManager.lstAbility[i].ShotXY.X - (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotXY.Y - (int)abilityManager.lstAbility[i].ShotSize.Y / 2, (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)objectManager.lstDynamit[j].Position.X, (int)objectManager.lstDynamit[j].Position.Y, 64, 64)) && !objectManager.lstDynamit[j].Exploded)
                        {
                            objectManager.lstDynamit[j].Explosion = true;
                            abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);//lstAbility entfernen
                            break;
                        }
                    }
                }

                if (i < enemyManager.lstGegnerShot.Count)//Gegner Schüsse
                {
                    enemyManager.lstGegnerShot[i].Update(gameTime);

                    if (enemyManager.lstGegnerShot[i].ShotXY.X > 1920 || enemyManager.lstGegnerShot[i].ShotXY.Y > 1080 ||
                        enemyManager.lstGegnerShot[i].ShotXY.X < 0 || enemyManager.lstGegnerShot[i].ShotXY.Y <0 || enemyManager.lstGegnerShot[i].CurrentTime> 10f ||
                        collision.BulletCollision(new Vector2(Convert.ToInt32(enemyManager.lstGegnerShot[i].ShotXY.X), Convert.ToInt32(enemyManager.lstGegnerShot[i].ShotXY.Y)), (int)enemyManager.lstGegnerShot[i].ShotSize.Y, (int)enemyManager.lstGegnerShot[i].ShotSize.X, enemyManager.lstGegnerShot[i].Rotation))
                    {
                        particleManager.SpawnStandardParticle(enemyManager.lstGegnerShot[i].ShotXY - enemyManager.lstGegnerShot[i].ShotSize / 2);
                        enemyManager.lstGegnerShot.Remove(enemyManager.lstGegnerShot[i]);//EnemyShot entfernen
                        continue;
                    }

                    if (new Rectangle((int)(enemyManager.lstGegnerShot[i].ShotXY.X), (int)(enemyManager.lstGegnerShot[i].ShotXY.Y), (int)enemyManager.lstGegnerShot[i].ShotSize.X, (int)enemyManager.lstGegnerShot[i].ShotSize.Y).Intersects
                            (new Rectangle((int)movement.position.X, (int)movement.position.Y, 32, 48)))
                    {
                        _player.LebenAbziehen(enemyManager.lstGegnerShot[i].ShotDamage, (int)currentSpieler, particleManager, enemyManager.lstGegnerShot[i].ShotXY, game);
                        enemyManager.lstGegnerShot.Remove(enemyManager.lstGegnerShot[i]);//EnemyShot entfernen
                    }
                }

                if (i < objectManager.lstDynamitArrowTrapBullets.Count)//Dynamit
                {
                    objectManager.lstDynamitArrowTrapBullets[i].Update(gameTime);

                    if (objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X > 1920 || objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y > 1080 ||
                        objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X < 0 || objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y <0 || objectManager.lstDynamitArrowTrapBullets[i].CurrentTime> 10f ||
                        collision.BulletCollision(new Vector2(Convert.ToInt32(objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X), Convert.ToInt32(objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y)), (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X, objectManager.lstDynamitArrowTrapBullets[i].Rotation))
                    {
                        particleManager.SpawnStandardParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY - objectManager.lstDynamitArrowTrapBullets[i].ShotSize / 2);
                        objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);//EnemyShot entfernen

                        continue;
                    }

                    if (new Rectangle(Convert.ToInt32(objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2), Convert.ToInt32(objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2), (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2).Intersects
                            (new Rectangle((int)movement.position.X, (int)movement.position.Y, 32, 48)))
                    {
                        _player.LebenAbziehen(objectManager.lstDynamitArrowTrapBullets[i].ShotDamage, (int)currentSpieler, particleManager, objectManager.lstDynamitArrowTrapBullets[i].ShotXY, game);

                        objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);//EnemyShot entfernen

                        continue;
                    }

                    for (int j = 0; j < objectManager.lstDynamit.Count; j++)
                    {
                        if (new Rectangle((int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)objectManager.lstDynamit[j].Position.X, (int)objectManager.lstDynamit[j].Position.Y, 64, 64)) && !objectManager.lstDynamit[j].Exploded)
                        {
                            objectManager.lstDynamit[j].Explosion = true;
                            objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);//AutoAttack entfernen
                            break;
                        }
                    }
                }
            }

            for (int j = 0; j < enemyManager.lstGegnerRanged.Count; j++)//Bullet Collision
            {
                for (int i = 0; i < abilityManager.lstAbility.Count || i < objectManager.lstDynamitArrowTrapBullets.Count; i++)
                {
                    if (i < abilityManager.lstAbility.Count)
                    {
                        if (new Rectangle((int)abilityManager.lstAbility[i].ShotXY.X - (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotXY.Y - (int)abilityManager.lstAbility[i].ShotSize.Y / 2, (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)enemyManager.lstGegnerRanged[j].EnemyXY.X, (int)enemyManager.lstGegnerRanged[j].EnemyXY.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X, (int)enemyManager.lstGegnerRanged[j].EnemySize.Y)))
                        {
                            particleManager.SpawnHitParticle(abilityManager.lstAbility[i].ShotXY, -abilityManager.lstAbility[i].ShotDamage, Color.LightBlue);
                            particleManager.SpawnStandardParticle(abilityManager.lstAbility[i].ShotXY - abilityManager.lstAbility[i].ShotSize / 2);

                            if (enemyManager.lstGegnerRanged[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 < 1920 - 64 && enemyManager.lstGegnerRanged[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 < 1080 - 64 &&
                                enemyManager.lstGegnerRanged[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 > 0 + 64 && enemyManager.lstGegnerRanged[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 > 0 + 64)//+-64 = 2*RandCollision
                            {
                                if (abilityManager.lstAbility[i].DirectionXY.X < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerRanged[j].EnemyXY.Y), (int)enemyManager.lstGegnerRanged[j].EnemySize.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerRanged[j].EnemyXY = new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerRanged[j].EnemyXY.Y);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.X >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerRanged[j].EnemyXY.Y), (int)enemyManager.lstGegnerRanged[j].EnemySize.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerRanged[j].EnemyXY = new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerRanged[j].EnemyXY.Y);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.Y < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X, enemyManager.lstGegnerRanged[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstGegnerRanged[j].EnemySize.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerRanged[j].EnemyXY = new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X, enemyManager.lstGegnerRanged[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.Y >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X, enemyManager.lstGegnerRanged[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstGegnerRanged[j].EnemySize.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerRanged[j].EnemyXY = new Vector2(enemyManager.lstGegnerRanged[j].EnemyXY.X, enemyManager.lstGegnerRanged[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                }
                            }

                            enemyManager.lstGegnerRanged[j].EnemyHP    -= abilityManager.lstAbility[i].ShotDamage; //Leben abziehen
                            enemyManager.lstGegnerRanged[j].EnemyTarget = true;                                    //Damit Spieler im visier ist auch wenn der Spieler nicht in range ist


                            if (enemyManager.lstGegnerRanged[j].EnemyHP <= 0)
                            {
                                objectManager.SpawnCoinXP(enemyManager.lstGegnerRanged[j].EnemyXY);
                                enemyManager.lstGegnerRanged.RemoveAt(j);
                                abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);
                                break;
                            }
                            abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);

                            continue;
                        }
                    }

                    if (i < objectManager.lstDynamitArrowTrapBullets.Count)
                    {
                        if (new Rectangle((int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)enemyManager.lstGegnerRanged[j].EnemyXY.X, (int)enemyManager.lstGegnerRanged[j].EnemyXY.Y, (int)enemyManager.lstGegnerRanged[j].EnemySize.X, (int)enemyManager.lstGegnerRanged[j].EnemySize.Y)))
                        {
                            particleManager.SpawnStandardParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY - objectManager.lstDynamitArrowTrapBullets[i].ShotSize / 2);
                            particleManager.SpawnHitParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY, -objectManager.lstDynamitArrowTrapBullets[i].ShotDamage, Color.LightBlue);

                            enemyManager.lstGegnerRanged[j].EnemyHP    -= objectManager.lstDynamitArrowTrapBullets[i].ShotDamage;
                            enemyManager.lstGegnerRanged[j].EnemyTarget = true;

                            if (enemyManager.lstGegnerRanged[j].EnemyHP <= 0)
                            {
                                objectManager.SpawnCoinXP(enemyManager.lstGegnerRanged[j].EnemyXY);
                                enemyManager.lstGegnerRanged.RemoveAt(j);
                                objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);
                                break;
                            }

                            objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);

                            continue;
                        }
                    }
                }
            }

            for (int j = 0; j < enemyManager.lstGegnerMelee.Count; j++)//Bullet Collision
            {
                if (new Rectangle((int)enemyManager.lstGegnerMelee[j].EnemyXY.X, (int)enemyManager.lstGegnerMelee[j].EnemyXY.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X, (int)enemyManager.lstGegnerMelee[j].EnemySize.Y).Intersects(new Rectangle((int)movement.position.X, (int)movement.position.Y, 32, 48)) && enemyManager.lstGegnerMelee[j].EnemyCooldown >= enemyManager.lstGegnerMelee[j].EnemyCooldownMax)
                {
                    _player.LebenAbziehen(enemyManager.lstGegnerMelee[j].EnemyDamage, currentSpieler, particleManager, movement.position, game);
                    enemyManager.lstGegnerMelee[j].EnemyCooldown = 0f;
                }

                for (int i = 0; i < abilityManager.lstAbility.Count || i < objectManager.lstDynamitArrowTrapBullets.Count; i++)
                {
                    if (i < abilityManager.lstAbility.Count)
                    {
                        if (new Rectangle((int)abilityManager.lstAbility[i].ShotXY.X - (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotXY.Y - (int)abilityManager.lstAbility[i].ShotSize.Y / 2, (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)enemyManager.lstGegnerMelee[j].EnemyXY.X, (int)enemyManager.lstGegnerMelee[j].EnemyXY.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X, (int)enemyManager.lstGegnerMelee[j].EnemySize.Y)))
                        {
                            particleManager.SpawnHitParticle(abilityManager.lstAbility[i].ShotXY, -abilityManager.lstAbility[i].ShotDamage, Color.LightBlue);
                            particleManager.SpawnStandardParticle(abilityManager.lstAbility[i].ShotXY);

                            if (enemyManager.lstGegnerMelee[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 < 1920 - 64 && enemyManager.lstGegnerMelee[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 < 1080 - 64 &&
                                enemyManager.lstGegnerMelee[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 > 0 + 64 && enemyManager.lstGegnerMelee[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 > 0 + 64)//+-64 = 2*RandCollision
                            {
                                if (abilityManager.lstAbility[i].DirectionXY.X < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerMelee[j].EnemyXY.Y), (int)enemyManager.lstGegnerMelee[j].EnemySize.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerMelee[j].EnemyXY = new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerMelee[j].EnemyXY.Y);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.X >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerMelee[j].EnemyXY.Y), (int)enemyManager.lstGegnerMelee[j].EnemySize.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerMelee[j].EnemyXY = new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstGegnerMelee[j].EnemyXY.Y);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.Y < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X, enemyManager.lstGegnerMelee[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstGegnerMelee[j].EnemySize.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerMelee[j].EnemyXY = new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X, enemyManager.lstGegnerMelee[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                }

                                if (abilityManager.lstAbility[i].DirectionXY.Y >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X, enemyManager.lstGegnerMelee[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstGegnerMelee[j].EnemySize.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X))
                                {
                                    enemyManager.lstGegnerMelee[j].EnemyXY = new Vector2(enemyManager.lstGegnerMelee[j].EnemyXY.X, enemyManager.lstGegnerMelee[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                }
                            }

                            enemyManager.lstGegnerMelee[j].EnemyHP    -= abilityManager.lstAbility[i].ShotDamage;
                            enemyManager.lstGegnerMelee[j].EnemyTarget = true;

                            if (enemyManager.lstGegnerMelee[j].EnemyHP <= 0)
                            {
                                objectManager.SpawnCoinXP(enemyManager.lstGegnerMelee[j].EnemyXY);
                                enemyManager.lstGegnerMelee.RemoveAt(j);
                                abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);
                                break;
                            }


                            abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);


                            continue;
                        }
                    }

                    if (i < objectManager.lstDynamitArrowTrapBullets.Count)
                    {
                        if (new Rectangle((int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2).Intersects
                                (new Rectangle((int)enemyManager.lstGegnerMelee[j].EnemyXY.X, (int)enemyManager.lstGegnerMelee[j].EnemyXY.Y, (int)enemyManager.lstGegnerMelee[j].EnemySize.X, (int)enemyManager.lstGegnerMelee[j].EnemySize.Y)))
                        {
                            particleManager.SpawnHitParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY, -objectManager.lstDynamitArrowTrapBullets[i].ShotDamage, Color.LightBlue);
                            particleManager.SpawnStandardParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY);

                            enemyManager.lstGegnerMelee[j].EnemyHP    -= objectManager.lstDynamitArrowTrapBullets[i].ShotDamage;
                            enemyManager.lstGegnerMelee[j].EnemyTarget = true;

                            if (enemyManager.lstGegnerMelee[j].EnemyHP <= 0)
                            {
                                objectManager.SpawnCoinXP(enemyManager.lstGegnerMelee[j].EnemyXY);
                                enemyManager.lstGegnerMelee.RemoveAt(j);
                                objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);

                                break;
                            }


                            objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);

                            continue;
                        }
                    }
                }
            }

            for (int j = 0; j < enemyManager.lstBoss.Count; j++)
            {
                if (enemyManager.lstBoss[j].State == 1)
                {
                    for (int i = 0; i < abilityManager.lstAbility.Count || i < abilityManager.lstNoCollision.Count || i < objectManager.lstDynamitArrowTrapBullets.Count; i++)
                    {
                        if (i < abilityManager.lstAbility.Count)
                        {
                            if (new Rectangle((int)abilityManager.lstAbility[i].ShotXY.X - (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotXY.Y - (int)abilityManager.lstAbility[i].ShotSize.Y / 2, (int)abilityManager.lstAbility[i].ShotSize.X / 2, (int)abilityManager.lstAbility[i].ShotSize.Y / 2).Intersects
                                    (new Rectangle((int)enemyManager.lstBoss[j].EnemyXY.X, (int)enemyManager.lstBoss[j].EnemyXY.Y, (int)enemyManager.lstBoss[j].EnemySize.X, (int)enemyManager.lstBoss[j].EnemySize.Y)))
                            {
                                particleManager.SpawnHitParticle(abilityManager.lstAbility[i].ShotXY, -abilityManager.lstAbility[i].ShotDamage, Color.LightBlue);
                                particleManager.SpawnStandardParticle(abilityManager.lstAbility[i].ShotXY);

                                if (enemyManager.lstBoss[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 < 1920 - 64 && enemyManager.lstBoss[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 < 1080 - 64 &&
                                    enemyManager.lstBoss[j].EnemyXY.X + abilityManager.lstAbility[i].DirectionXY.X / 64 > 0 + 64 && enemyManager.lstBoss[j].EnemyXY.Y + abilityManager.lstAbility[i].DirectionXY.Y / 64 > 0 + 64)//+-64 = 2*RandCollision
                                {
                                    if (abilityManager.lstAbility[i].DirectionXY.X < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstBoss[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstBoss[j].EnemyXY.Y), (int)enemyManager.lstBoss[j].EnemySize.Y, (int)enemyManager.lstBoss[j].EnemySize.X))
                                    {
                                        enemyManager.lstBoss[j].EnemyXY = new Vector2(enemyManager.lstBoss[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstBoss[j].EnemyXY.Y);
                                    }

                                    if (abilityManager.lstAbility[i].DirectionXY.X >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstBoss[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstBoss[j].EnemyXY.Y), (int)enemyManager.lstBoss[j].EnemySize.Y, (int)enemyManager.lstBoss[j].EnemySize.X))
                                    {
                                        enemyManager.lstBoss[j].EnemyXY = new Vector2(enemyManager.lstBoss[j].EnemyXY.X + (int)abilityManager.lstAbility[i].DirectionXY.X / 64, enemyManager.lstBoss[j].EnemyXY.Y);
                                    }

                                    if (abilityManager.lstAbility[i].DirectionXY.Y < 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstBoss[j].EnemyXY.X, enemyManager.lstBoss[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstBoss[j].EnemySize.Y, (int)enemyManager.lstBoss[j].EnemySize.X))
                                    {
                                        enemyManager.lstBoss[j].EnemyXY = new Vector2(enemyManager.lstBoss[j].EnemyXY.X, enemyManager.lstBoss[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                    }

                                    if (abilityManager.lstAbility[i].DirectionXY.Y >= 0 && collision.KnockbackCollision(new Vector2(enemyManager.lstBoss[j].EnemyXY.X, enemyManager.lstBoss[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64), (int)enemyManager.lstBoss[j].EnemySize.Y, (int)enemyManager.lstBoss[j].EnemySize.X))
                                    {
                                        enemyManager.lstBoss[j].EnemyXY = new Vector2(enemyManager.lstBoss[j].EnemyXY.X, enemyManager.lstBoss[j].EnemyXY.Y + (int)abilityManager.lstAbility[i].DirectionXY.Y / 64);
                                    }
                                }

                                enemyManager.lstBoss[j].EnemyHP    -= abilityManager.lstAbility[i].ShotDamage;
                                enemyManager.lstBoss[j].EnemyTarget = true;

                                if (enemyManager.lstBoss[j].EnemyHP <= 0)
                                {
                                    objectManager.SpawnChest(enemyManager.lstBoss[j].EnemyXY + enemyManager.lstBoss[j].EnemySize / 2);
                                    enemyManager.lstBoss.RemoveAt(j);
                                    abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);
                                    break;
                                }


                                abilityManager.lstAbility.Remove(abilityManager.lstAbility[i]);


                                continue;
                            }
                        }

                        if (i < objectManager.lstDynamitArrowTrapBullets.Count)
                        {
                            if (new Rectangle((int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.X - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotXY.Y - (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.X / 2, (int)objectManager.lstDynamitArrowTrapBullets[i].ShotSize.Y / 2).Intersects
                                    (new Rectangle((int)enemyManager.lstBoss[j].EnemyXY.X, (int)enemyManager.lstBoss[j].EnemyXY.Y, (int)enemyManager.lstBoss[j].EnemySize.X, (int)enemyManager.lstBoss[j].EnemySize.Y)))
                            {
                                particleManager.SpawnHitParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY, -objectManager.lstDynamitArrowTrapBullets[i].ShotDamage, Color.LightBlue);
                                particleManager.SpawnStandardParticle(objectManager.lstDynamitArrowTrapBullets[i].ShotXY);

                                enemyManager.lstBoss[j].EnemyHP    -= objectManager.lstDynamitArrowTrapBullets[i].ShotDamage;
                                enemyManager.lstBoss[j].EnemyTarget = true;

                                if (enemyManager.lstBoss[j].EnemyHP <= 0)
                                {
                                    objectManager.SpawnCoinXP(enemyManager.lstBoss[j].EnemyXY);
                                    enemyManager.lstBoss.RemoveAt(j);
                                    objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);

                                    break;
                                }


                                objectManager.lstDynamitArrowTrapBullets.Remove(objectManager.lstDynamitArrowTrapBullets[i]);

                                continue;
                            }
                        }

                        if (i < abilityManager.lstNoCollision.Count)
                        {
                            if (new Rectangle((int)abilityManager.lstNoCollision[i].ShotXY.X - (int)abilityManager.lstNoCollision[i].ShotSize.X / 2, (int)abilityManager.lstNoCollision[i].ShotXY.Y - (int)abilityManager.lstNoCollision[i].ShotSize.Y / 2, (int)abilityManager.lstNoCollision[i].ShotSize.X / 2, (int)abilityManager.lstNoCollision[i].ShotSize.Y / 2).Intersects
                                    (new Rectangle((int)enemyManager.lstBoss[j].EnemyXY.X, (int)enemyManager.lstBoss[j].EnemyXY.Y, (int)enemyManager.lstBoss[j].EnemySize.X, (int)enemyManager.lstBoss[j].EnemySize.Y)))
                            {
                                abilityManager.lstNoCollision[i].CurrentTime = 0.89f;
                                abilityManager.lstNoCollision[i].ShotSpeed   = 0f;
                            }
                        }
                    }
                }
            }
        }