Example #1
0
 public void Handle_and_CheckWeaponCollision(GameObject gameObject)
 {
     if (gameObject.isAlive)
     {
         foreach (KeyValuePair<int, WeaponObject[]> entry in mainPlayer.weaponDict)
         {
             foreach (WeaponObject w in entry.Value)
             {
                 if (w.isAlive && w.isSolid)
                 {
                     if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height))
                     {
                         w.isAlive = false;
                         gameObject.isAlive = false;
                         gameObject.isKilled = true;
                         Game.Components.Remove(gameObject);
                         gameObject.Dispose();
                     }
                 }
             }
         }
     }
 }
Example #2
0
        public void Handle_and_CheckWeaponCollisionFeynman(GameObject gameObject)
        {
            if (gameObject.isAlive)
            {
                foreach (KeyValuePair<int, WeaponObject[]> entry in mainPlayer.weaponDict)
                {
                    foreach (WeaponObject w in entry.Value)
                    {
                        if (w.isAlive && w.isSolid)
                        {
                            if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height))
                            {
                                w.isAlive = false;
                                gameObject.position.Y -= bulletPush;

                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public void Handle_and_CheckWeaponCollisionLightUp(GameObject gameObject,GameTime gameTime)
        {
            if (gameObject.isAlive)
            {
                foreach (KeyValuePair<int, WeaponObject[]> entry in mainPlayer.weaponDict)
                {
                    foreach (WeaponObject w in entry.Value)
                    {
                        if (w.isAlive && w.isSolid)
                        {
                            if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height))
                            {
                                w.isAlive = false;

                                gameObject.customRGBA += 3;
                                gameObject.rotation -= 0.003f;
                                totalAngularVelocity -= 0.003f;

                                if (gameObject.customRGBA > 254)
                                {

                                    PE1.AddExplosion(PE1.ParticleArray, PE1.MaxParticles, gameObject.position, PE1.ExplosionSize, gameTime, w.velocity);
                                    mainPlayer.activeTextureID = 11;
                                    gameObject.isAlive = false;
                                    gameObject.isKilled = true;
                                    Game.Components.Remove(gameObject);
                                    gameObject.Dispose();
                                }
                            }

                        }
                    }
                }
            }
        }