Beispiel #1
0
 public void onHit(eCollision e)
 {
     if (getComponent<Collidable>().health <= 0)
     {
         dispose();
     }
 }
Beispiel #2
0
        public void onHit(eCollision e)
        {
            Collidable otherObject;
            if (e.hitObject == getComponent<Collidable>())
            {
                otherObject = e.mainObject;
            }
            else
            {
                otherObject = e.hitObject;
            }

            if (otherObject.getComponent<Powerable>() != null)
            {
                switch (type)
                {
                    case powerType.stealth:
                        otherObject.getComponent<Powerable>().stealth();
                        break;
                    case powerType.shield:
                        otherObject.getComponent<Powerable>().shield();
                        break;
                    case powerType.ammo:
                        otherObject.getComponent<Powerable>().ammo();
                        break;
                    case powerType.ring:
                        otherObject.getComponent<Powerable>().ring();
                        break;
                    default:
                        break;
                }
                powerUpManager.removePowerUp(this);
                dispose();
            }
        }
Beispiel #3
0
 public void onHit(eCollision e)
 {
     Collidable c = getComponent<Collidable>();
     if (c != null && c.health <= 0)
     {
         bulletManager.remove(this);
         dispose();
     }
 }
Beispiel #4
0
        public void onHit(eCollision e)
        {
            if (e.mainObject == getComponent<Collidable>())
            {
                if (e.hitObject.damage > 0)
                {
                    recentlyHit += .75f;
                }
            }
            else
            {
                if (e.mainObject.damage > 0)
                {
                    recentlyHit += .75f;
                }
            }

            Collidable c = getComponent<Collidable>();
            if (c != null && c.health <= 0)
            {
                Vector3 position = getComponent<Spatial>().position;
                new PowerUp(Game, position, powerType.ring);
                var explosion = new ExplosionParticleSystem(Game, Game.Content);
                ParticleEmitterManager.addParticleEmitter(new ParticleEmitter(Game, explosion, 40, 2.0f, position));
                var smoke = new ExplosionSmokeParticleSystem(Game, Game.Content);
                ParticleEmitterManager.addParticleEmitter(new ParticleEmitter(Game, smoke, 50, 3.0f, position));
                dispose();
                SoundManager.playSound("Explosion", position);
                ((Game1)Game).addAnEnemy();
            }
        }
Beispiel #5
0
 public void onHit(eCollision e)
 {
 }
Beispiel #6
0
        //void disperseClouds()
        //{
        //    for (int i = 0; i <= worldRadius * 2; i += ((int)(worldRadius * 2) / 5))
        //    {
        //        for (int j = 0; j <= worldRadius; j += ((int)(worldRadius) / 5))
        //        {
        //            for (int k = 0; k <= worldRadius * 2; k += ((int)(worldRadius * 2) / 5))
        //            {
        //                Vector3 initPos = new Vector3(i - worldRadius, j, k - worldRadius);
        //                makeCloud(initPos);
        //            }
        //        }
        //    }
        //    emitClouds();
        //}
        //void makeCloud(Vector3 initPos)
        //{
        //    if (initPos.Length() < worldRadius)
        //    {
        //        clouds.Add(new StationaryParticleEmitter(ref cloudParticles, initPos, 600, 400, 400, 300));
        //    }
        //}
        //void emitClouds()
        //{
        //    foreach (StationaryParticleEmitter spe in clouds)
        //    {
        //        spe.Emit();
        //    }
        //}
        public void onHit(eCollision e)
        {
            if (e.mainObject == getComponent<Collidable>())
            {
                if (e.hitObject.damage > 50)
                {
                    SoundManager.playSound("Alarm");
                    ((Game1)Game).currentVibration += 1.0f;
                }
                else if(e.hitObject.damage > 0)
                {
                    SoundManager.playSound("BulletImpact");
                    ((Game1)Game).currentVibration += 0.1f;

                }
            }
            else
            {
                if (e.mainObject.damage > 50)
                {
                    SoundManager.playSound("Alarm");
                    ((Game1)Game).currentVibration += 1.0f;
                }
                else if (e.mainObject.damage > 0)
                {
                    SoundManager.playSound("BulletImpact");
                    ((Game1)Game).currentVibration += 0.1f;
                }
            }
            Collidable c = getComponent<Collidable>();
            if ( c != null && c.health <= 0)
            {
                SoundManager.playSound("Explosion");
                removeComponent<Drawable3D>();
                Spatial sp = getComponent<Spatial>();
                var explosion = new ExplosionParticleSystem(Game, Game.Content);
                ParticleEmitterManager.addParticleEmitter(new ParticleEmitter(Game, explosion, 40, 2.0f,sp.position));
                var smoke = new ExplosionSmokeParticleSystem(Game, Game.Content);
                ParticleEmitterManager.addParticleEmitter(new ParticleEmitter(Game, smoke, 50, 3.0f,sp.position));

                getComponent<Spatial>().position = new Vector3(1000000, 1000000, 1000000);
            }
        }
Beispiel #7
0
 public void onHit(eCollision e)
 {
     count++;
 }