Ejemplo n.º 1
0
 public override void dispose()
 {
     Vector3 position = getComponent<Spatial>().position;
     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));
     SoundManager.stopCue("fireMissile");
     SoundManager.playSound("Explosion", position);
     base.dispose();
 }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
Archivo: Player.cs Proyecto: kozupi/--
        //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);
            }
        }