예제 #1
0
        public void Update(double currentTimeAbsoluteSecs, Emitter e)
        {
            time = (float)(currentTimeAbsoluteSecs - creationTimeAbsoluteSecs);
            posShift = time * velocity;
            dist = posShift.Length() * ((time < 0) ? -1 : 1);

            if (e == null)
                position = originalPos + posShift;
            else
                position = e.position + e.startDistance * vUnit + posShift;
            switch (deathMode)
            {
                case ParticleDeathMode.Seconds:
                    lifecycle = time / valueToDeath;
                    break;
                case ParticleDeathMode.Distance:
                    lifecycle = dist / valueToDeath;
                    break;
            }
            if (lifecycle > 1 || lifecycle < 0)
            {
                return;
            }
            float r, g, b, a;
            a = (startColor.A * (1 - lifecycle) + endColor.A * lifecycle);
            color.A = (byte) a;
            r = (startColor.R * (1 - lifecycle) + endColor.R * lifecycle);
            g = (startColor.G * (1 - lifecycle) + endColor.G * lifecycle);
            b = (startColor.B * (1 - lifecycle) + endColor.B * lifecycle);
            color.R = (byte)Math.Min(a, r);
            color.G = (byte)Math.Min(a, g);
            color.B = (byte)Math.Min(a, b);
            size = startSize * (1 - lifecycle) + endSize * lifecycle;
        }
예제 #2
0
 public Flame(Hero hero, float damagePerSecond, float offset)
     : base(new Vector2(hero.position.X, hero.position.Y), new Hitbox(32, 32))
 {
     active = false;
     this.hero = hero;
     this.offset = offset;
     setTexture("flame");
     this.damagePerSecond = damagePerSecond;
     flameEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.FlameFire);
 }
예제 #3
0
 public Collectable(int x,int y, int levelX, int levelY, int tileX, int tileY)
     : base(new Vector2(x, y), new Hitbox(32, 32))
 {
     CollectedSound = "CollectGem";
     ActionAfterCollected = CollectedAction.Delete;
     this.setTexture("collectable3");
     this.levelX = levelX;
     this.levelY = levelY;
     this.tileX = tileX;
     this.tileY = tileY;
     emitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.CollectedSparks);
     emitter.position = position;
     scale = 0.5f;
 }
예제 #4
0
 public Enemy(int x, int y, int type, Level l, bool forceSandToSpawn = false)
     : base(new Vector2(Level.TEX_SIZE * l.xPos + (x * Level.TILE_SIZE) + Level.TILE_SIZE / 2, Level.TEX_SIZE * l.yPos + (y * Level.TILE_SIZE) + Level.TILE_SIZE / 2), new Hitbox(32, 32))
 {
     level = l;
     tileX = x;
     tileY = y;
     this.forceSandToSpawn = forceSandToSpawn;
     this.type = type;
     this.setTexture("enemy" + (type + 1));
     id = idCounter++;
     health = STARTING_HEALTH;
     scale = 0.5f;
     deathEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.EnemyDeathExplosion);
     idleAI = new TurnInPlaceAI((float)RetroGame.rand.NextDouble() * 2, RetroGame.rand.Next(5));
     targetedAI = new HeroChaseAI(true);
 }
예제 #5
0
        public Bullet(GunPowerup gunPowerup, string textureName, PrebuiltEmitter trailEmitterType, Color emitterColor, Direction dir, float distanceLimit, int damage, bool phasing = false)
            : base(new Vector2(0, 0), new Hitbox(0, 0))
        {
            this.gunPowerup = gunPowerup;
            this.textureName = textureName;
            this.setTexture(textureName);
            this.damage = damage;
            this.distanceLimit = distanceLimit;
            this.phasing = phasing;
            float emitterAngle = 0;
            switch (dir)
            {
                case Direction.Up:
                    velocity = new Vector2(0, -MOVE_SPEED);
                    emitterAngle = (float)Math.PI / 2;
                    rotation = 0;
                    break;
                case Direction.Down:
                    velocity = new Vector2(0, MOVE_SPEED);
                    emitterAngle = (float)Math.PI * 3 / 2;
                    rotation = (float)Math.PI;
                    break;
                case Direction.Left:
                    velocity = new Vector2(-MOVE_SPEED, 0);
                    emitterAngle = 0;
                    rotation = (float)Math.PI * 3 / 2;
                    break;
                case Direction.Right:
                    velocity = new Vector2(MOVE_SPEED, 0);
                    emitterAngle = (float)Math.PI;
                    rotation = (float)Math.PI / 2;
                    break;
            }
            trailEmitter = Emitter.getPrebuiltEmitter(trailEmitterType);
            //trailEmitter.targetAngle = emitterAngle;
            trailEmitter.angle = emitterAngle;
            trailEmitter.startColor = emitterColor;
            emitterColor.A = 0;
            trailEmitter.endColor = emitterColor;

            explosionEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.BulletHitExplosion);
            emitterColor = new Color(emitterColor.R / 2, emitterColor.G / 2, emitterColor.B / 2, 255);
            explosionEmitter.startColor = emitterColor;
            emitterColor.A = 0;
            explosionEmitter.endColor = emitterColor;
            explosionEmitter.active = false;
        }
예제 #6
0
        public void LoadContent(ContentManager content)
        {
            Emitter smokeEmitter = new Emitter();
            smokeEmitter.Active = true;
            smokeEmitter.TextureList.Add(content.Load<Texture2D>("smoke"));
            smokeEmitter.RandomEmissionInterval = new RandomMinMax(45);
            smokeEmitter.ParticleLifeTime = 1350;
            smokeEmitter.ParticleDirection = new RandomMinMax(-15, 15);
            smokeEmitter.ParticleSpeed = new RandomMinMax(4.5f);
            smokeEmitter.ParticleRotation = new RandomMinMax(0);
            smokeEmitter.RotationSpeed = new RandomMinMax(-0.008f, 0.008f);
            smokeEmitter.ParticleFader = new ParticleFader(true, true);
            smokeEmitter.ParticleScaler = new ParticleScaler(0.2f, 1.2f, 50, smokeEmitter.ParticleLifeTime);
            smokeEmitter.Position = new Vector2(640, 550);

            particleEmitterList.Add(smokeEmitter);
        }
예제 #7
0
        public ShotCharge(Hero hero)
            : base(hero)
        {
            /* Set these properties for your specific powerup */
            GenericName = "Gun";
            SpecificName = "Charge Shot";
            Rank = 1; //when should this powerup be updated/drawn in relation to all other powerups? (lower ranks first)
            Active = true; //is this powerup activated with a button press?
            StoreOnly = true; //can the powerup be found randomly in a level, or can it only be bought in the store?
            Icon = TextureManager.Get("chargeshoticon2"); //filename for this powerup's icon
            DrawBeforeHero = false; //should the powerup's effects be drawn before the sprite of the hero, or above?
            TintColor = Color.Goldenrod; //what color should this powerup's icon and related effects be?
            Description = "A slow firing gun that\ncharges up when held"; //give a short description (with appropriate newlines) of the powerup, for display to the player
            GemCost = COST_EXPENSIVE;

            chargeEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.ChargingSparks);
        }
예제 #8
0
        public DrillFast(Hero hero)
            : base(hero)
        {
            /* Set these properties for your specific powerup */
            GenericName = "Drill";
            SpecificName = "Fast";
            Rank = 1; //when should this powerup be updated/drawn in relation to all other powerups? (lower ranks first)
            Active = false; //is this powerup activated with a button press?
            StoreOnly = true; //can the powerup be found randomly in a level, or can it only be bought in the store?
            Icon = TextureManager.Get("drillicon1"); //filename for this powerup's icon
            DrawBeforeHero = false; //should the powerup's effects be drawn before the sprite of the hero, or above?
            GemCost = COST_EXPENSIVE; //how many gems does it take to buy this from the store?
            TintColor = Color.LightGray; //what color should this powerup's icon and related effects be?
            Description = "Drills through a\nsingle wall quickly"; //give a short description (with appropriate newlines) of the powerup, for display to the player

            DrillSoundName = "FastDrillLoop";
            DrillTime = DRILL_SINGLE_TIME;
            drillEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.DrillSparks);
        }
예제 #9
0
        public AdrenalinePickup(Hero hero)
            : base(hero)
        {
            GenericName = "Adrenaline";
            SpecificName = "Pickup";
            Rank = 1; //when should this powerup be updated/drawn in relation to all other powerups? (lower ranks first)
            Active = true; //is this powerup activated with a button press?
            StoreOnly = false; //can the powerup be found randomly in a level, or can it only be bought in the store?
            GemCost = COST_CHEAP; //how many gems does it take to buy this from the store?
            DrawBeforeHero = false;
            Icon = TextureManager.Get("adrenalinepickup");
            Description = "Temporarily reduces\ncooldown times when\nactivated";
            TintColor = Color.GreenYellow;

            modifier = 2f;
            adrenalineEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.ChargingSparks);
            adrenalineEmitter.startColor = Color.Yellow;
            adrenalineEmitter.endColor = Color.Red;
        }
예제 #10
0
        public TimedSpeedBoost(Hero hero)
            : base(hero)
        {
            /* Set these properties for your specific powerup */
            GenericName = "Speed";
            SpecificName = "Pickup";
            Rank = 1; //when should this powerup be updated/drawn in relation to all other powerups? (lower ranks first)
            Active = true; //is this powerup activated with a button press?
            StoreOnly = false; //can the powerup be found randomly in a level, or can it only be bought in the store?
            Icon = TextureManager.Get("fastforward"); //filename for this powerup's icon
            DrawBeforeHero = true; //should the powerup's effects be drawn before the sprite of the hero, or above?
            TintColor = Color.Green; //what color should this powerup's icon and related effects be?
            Description = "Temporarily speed\n yourself up once"; //give a short description (with appropriate newlines) of the powerup, for display to the player
            GemCost = COST_CHEAP;

            speedEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.ChargingSparks);
            speedEmitter.startColor = Color.LawnGreen;
            speedEmitter.endColor = Color.LightSkyBlue;
            speedEmitter.particlesPerSecond = 100;
        }
예제 #11
0
        public RocketBurst(Hero hero)
            : base(hero)
        {
            /* Set these properties for your specific powerup */
            GenericName = "Rocket";
            SpecificName = "Burst";
            Rank = 1; //when should this powerup be updated/drawn in relation to all other powerups? (lower ranks first)
            Active = true; //is this powerup activated with a button press?
            StoreOnly = false; //can the powerup be found randomly in a level, or can it only be bought in the store?
            Icon = TextureManager.Get("boosticon1");
            DrawBeforeHero = true;
            GemCost = COST_EXPENSIVE; //how many gems does it take to buy this from the store?
            TintColor = Color.DodgerBlue; //what color should this powerup's icon and related effects be?
            Description = "Activate for a strong\ntemporary boost in\nmovement speed"; //give a short description (with appropriate newlines) of the powerup, for display to the player

            leftBoosterFiring = Emitter.getPrebuiltEmitter(PrebuiltEmitter.RocketBoostFire);
            rightBoosterFiring = Emitter.getPrebuiltEmitter(PrebuiltEmitter.RocketBoostFire);
            leftBoosterIdle = Emitter.getPrebuiltEmitter(PrebuiltEmitter.IdleBoostFire);
            rightBoosterIdle = Emitter.getPrebuiltEmitter(PrebuiltEmitter.IdleBoostFire);
            leftBooster = leftBoosterIdle;
            rightBooster = rightBoosterIdle;
            moveSpeedMultiplier = 1f;
        }
예제 #12
0
        /// <summary>
        /// load emitter data
        /// </summary>
        /// <param name="contentManager">the game ContentManager</param>
        /// <param name="xmlFile">the xml file</param>
        /// <returns>error code, 0 is no error</returns>
        public int Load(ContentManager contentManager, string xmlFile)
        {
            Dictionary<string, Texture2D> loadedTextures = new Dictionary<string, Texture2D>();
            Dictionary<string, VectorGraph> loadedGraphs = new Dictionary<string, VectorGraph>();

            Dictionary<string, Particle> loadedParticles = new Dictionary<string, Particle>();

            XElement document = XElement.Load(Path.Combine(contentManager.RootDirectory, xmlFile) + ".xml");

            int end = xmlFile.LastIndexOf('\\') + 1;
            string directory = xmlFile.Remove(end, xmlFile.Length - end);

            //XElement multiEmitter = document.Element("MultiEmitter");

            /////////////////////////////
            //Textures
            #region Textures

            foreach (XElement texture in document.Element("Textures").Elements())
            {
                Texture2D newTexture = contentManager.Load<Texture2D>(directory + texture.Attribute("texture").Value);
                loadedTextures.Add(texture.Name.LocalName, newTexture);
            }

            #endregion

            /////////////////////////////
            //Graphs
            #region Graphs

            foreach (XElement graph in document.Element("Graphs").Elements())
            {
                //make new graph
                VectorGraph newGraph;

                switch (graph.Attribute("type").Value)
                {
                    case "Basic":
                        newGraph = new BasicVectorGraph();
                        break;
                    case "Bezier":
                        newGraph = new BezierVectorGraph();
                        break;
                    default:
                        newGraph = new EmptyVectorGraph();
                        break;
                }

                //read through points in graph
                foreach (XElement point in graph.Elements())
                {
                    double x, y;
                    if (double.TryParse(point.Attribute("x").Value, out x) &&
                        double.TryParse(point.Attribute("y").Value, out y))
                    {
                        newGraph.AddPoint(new Vector2((float)x, (float)y));
                    }
                }

                //add graph to list
                loadedGraphs.Add(graph.Name.LocalName, newGraph);
            }

            #endregion

            /////////////////////////////
            //Particles
            #region Particles

            foreach (XElement particle in document.Element("Particles").Elements())
            {
                //make new
                Particle newParticle = new Particle();

                //read through attributes

                //double angle;
                double length;
                double scale;
                int r, g, b, a;
                double x, y;

                //texture
                loadedTextures.TryGetValue(particle.Element("Texture").Attribute("texture").Value, out newParticle.texture);

                //life length
                if (double.TryParse(particle.Element("Life").Attribute("length").Value, out length))
                {
                    newParticle.lifeLength = (float)length;
                }

                //size scale and graph
                if (double.TryParse(particle.Element("Size").Attribute("scale").Value, out scale))
                {
                    newParticle.SetPixelScale((float)scale);
                }

                if (particle.Element("Size").Attribute("graph").Value != "")
                {
                    loadedGraphs.TryGetValue(particle.Element("Size").Attribute("graph").Value, out newParticle.sizeGraph);
                }

                //colour and graph
                if (int.TryParse(particle.Element("Colour").Attribute("r").Value, out r) &&
                    int.TryParse(particle.Element("Colour").Attribute("g").Value, out g) &&
                    int.TryParse(particle.Element("Colour").Attribute("b").Value, out b) &&
                    int.TryParse(particle.Element("Colour").Attribute("a").Value, out a))
                {
                    newParticle.colour = new Color(r, g, b, a);
                }

                if (particle.Element("Colour").Attribute("graph").Value != "")
                {
                    loadedGraphs.TryGetValue(particle.Element("Colour").Attribute("graph").Value, out newParticle.colourGraph);
                }

                // angle and graph
                //if (double.TryParse(particle.Element("Rotation").Attribute("angle").Value, out angle))
                //{
                //    newParticle.rotation = (float)angle;
                //}

                if (particle.Element("Rotation").Attribute("graph").Value != "")
                {
                    loadedGraphs.TryGetValue(particle.Element("Rotation").Attribute("graph").Value, out newParticle.rotationGraph);
                }

                //acceleration
                if (double.TryParse(particle.Element("Acceleration").Attribute("x").Value, out x) &&
                    double.TryParse(particle.Element("Acceleration").Attribute("y").Value, out y))
                {
                    newParticle.acceleration = new Vector2((float)x, (float)y);
                }

                //decay
                if (double.TryParse(particle.Element("Decay").Attribute("x").Value, out x) &&
                    double.TryParse(particle.Element("Decay").Attribute("y").Value, out y))
                {
                    newParticle.decay = new Vector2((float)x, (float)y);
                }

                //add
                loadedParticles.Add(particle.Name.LocalName, newParticle);
            }

            #endregion

            /////////////////////////////
            //Emitters
            #region Emitters

            foreach (XElement emitter in document.Element("Emitters").Elements())
            {
                //make new
                Emitter newEmitter;// = new Emitter();

                Vector2 newOrigin = new Vector2();
                Vector2 newPower = new Vector2();
                float newDepth = 0.0f;
                float newRate = 0.0f;
                int newCount = 0;

                double x, y, depth;
                double rate; int count;

                List<BlendState> blendstateList = new List<BlendState>();

                //read through attributes

                //Origin
                if (double.TryParse(emitter.Element("Origin").Attribute("x").Value, out x) &&
                    double.TryParse(emitter.Element("Origin").Attribute("y").Value, out y) &&
                    double.TryParse(emitter.Element("Origin").Attribute("depth").Value, out depth))
                {
                    newOrigin = new Vector2((float)x, (float)y);
                    newDepth = (float)depth;
                }

                //power
                if (double.TryParse(emitter.Element("Power").Attribute("x").Value, out x) &&
                    double.TryParse(emitter.Element("Power").Attribute("y").Value, out y))
                {
                    newPower = new Vector2((float)x, (float)y);
                }

                //rate
                if (double.TryParse(emitter.Element("Rate").Attribute("rate").Value, out rate))
                {
                    newRate = (float)rate;
                }
                if (int.TryParse(emitter.Element("Rate").Attribute("count").Value, out count))
                {
                    newCount = count;
                }

                //blendstates
                foreach (XElement state in emitter.Element("BlendStates").Elements())
                {
                    switch (state.Attribute("state").Value)
                    {
                        case "Additive":
                            blendstateList.Add(BlendState.Additive);
                            break;
                        case "NonPremultiplied":
                            blendstateList.Add(BlendState.NonPremultiplied);
                            break;
                        case "Opaque":
                            blendstateList.Add(BlendState.Opaque);
                            break;
                        default:
                            blendstateList.Add(BlendState.AlphaBlend);
                            break;
                    }
                }

                //initialise and add
                Particle newParticle;
                if (loadedParticles.TryGetValue(emitter.Name.LocalName, out newParticle))
                {
                    newEmitter = new Emitter(newParticle, new Vector2(), newPower, newRate, newCount);
                    newEmitter.blendStates = blendstateList;
                    newEmitter.origin = newOrigin;
                    newEmitter.depth = newDepth;
                    newEmitter.emitFromSelf = emitFromSelf;

                    EmitterList.Add(newEmitter);
                }
            }

            #endregion
            ///////////////////
            // Exit out

            return 0;
        }
예제 #13
0
 public EmitterMemento(Emitter target)
 {
     //save necessary information from target here
     Target = target;
     totalSeconds = target.totalSeconds;
     position = target.position;
     particlesEmitted = target.particlesEmitted;
     particlesDeadThisFrame = target.particlesDeadThisFrame;
     angle = target.angle;
     active = target.active;
     speed = target.speed;
     valueToDeath = target.valueToDeath;
     startSize = target.startSize;
     endSize = target.endSize;
     startColor = target.startColor;
     endColor = target.endColor;
 }
예제 #14
0
        //public float targetAngle;
        //public float ANGULAR_VELOCITY = (float)Math.PI * 8;

        /* Hard coded emitter temples to use... get the particle emitter using this function instead of building your own.*/
        public static Emitter getPrebuiltEmitter(PrebuiltEmitter prebuiltEmitter)
        #region Prebuilt Emitter Declarations
        {
            Emitter e = null;
            switch (prebuiltEmitter)
            {
                case PrebuiltEmitter.BulletHitExplosion:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 100
                    , 0
                    , ParticleDeathMode.Distance
                    , 32
                    , 0
                    , 0.4f
                    , 0.4f
                    , new Color(255, 0, 0, 255)
                    , new Color(255, 0, 0, 0)
                    , ParticleRandType.Uniform
                    , 0.1f
                    , 0.05f
                    , 5
                    , 50
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 10
                    , -1
                    , 10
                    , false
                    , true
                    );
                    break;
                case PrebuiltEmitter.BurstBoostFire:
                    break;
                case PrebuiltEmitter.ChargingSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 40
                    , 0
                    , ParticleDeathMode.Seconds
                    , 0.3f
                    , 16
                    , 0.3f
                    , -1
                    , new Color(255, 215, 0, 255)
                    , new Color(255, 215, 0, 0)
                    , ParticleRandType.Uniform
                    , 0
                    , 0
                    , 0.1f
                    , 20
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 35
                    , 35
                    , -1
                    , false
                    , false
                    );
                    break;
                case PrebuiltEmitter.BlinkEndSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 40
                    , 0
                    , ParticleDeathMode.Seconds
                    , 0.3f
                    , 16
                    , 0.3f
                    , -1
                    , new Color(255, 215, 0, 255)
                    , new Color(255, 215, 0, 0)
                    , ParticleRandType.Uniform
                    , 0
                    , 0
                    , 0.1f
                    , 20
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 50
                    , 50
                    , 50
                    , false
                    , false
                    );
                    break;
                case PrebuiltEmitter.CollectedSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 75
                    , 0
                    , ParticleDeathMode.Seconds
                    , 1f
                    , 0
                    , 0.3f
                    , 0.7f
                    , new Color(111, 176, 172, 255)
                    , new Color(111, 176, 172, 0)
                    , ParticleRandType.Uniform
                    , 0.1f
                    , 0.2f
                    , 0
                    , 100
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 100
                    , -1
                    , 20
                    , false
                    , false
                    );
                    break;
                case PrebuiltEmitter.BlinkOriginSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 75
                    , 0
                    , ParticleDeathMode.Seconds
                    , 1f
                    , 0
                    , 0.3f
                    , 0.7f
                    , new Color(111, 176, 172, 255)
                    , new Color(111, 176, 172, 0)
                    , ParticleRandType.Uniform
                    , 0.1f
                    , 0.2f
                    , 0
                    , 100
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 100
                    , -1
                    , 20
                    , false
                    , false
                    );
                    break;
                case PrebuiltEmitter.DrillSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 100
                    , 0
                    , ParticleDeathMode.Seconds
                    , 0.5f
                    , 0
                    , 0.8f
                    , -1
                    , new Color(30, 30, 30, 128)
                    , new Color(30, 30, 30, 20)
                    , ParticleRandType.Uniform
                    , 0.2f
                    , 0.2f
                    , 0
                    , 50
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 100
                    , 20
                    , -1
                    , false
                    , true
                    );
                    break;
                case PrebuiltEmitter.EnemyDeathExplosion:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 100
                    , 0
                    , ParticleDeathMode.Distance
                    , 48
                    , 0
                    , 0.5f
                    , 0.5f
                    , new Color(71, 93, 65, 255)
                    , new Color(71, 93, 65, 0)
                    , ParticleRandType.Uniform
                    , 0
                    , 0
                    , 0
                    , 0
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 50
                    , -1
                    , 50
                    , false
                    , true
                    );
                    break;
                case PrebuiltEmitter.IdleBoostFire:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 30
                    , 0
                    , ParticleDeathMode.Distance
                    , 12
                    , 0
                    , 0.3f
                    , 0.1f
                    , Color.White
                    , new Color(0, 200, 100, 50)
                    , ParticleRandType.Gaussian
                    , 0.1f
                    , 0.05f
                    , 3
                    , 15
                    , 0.25f
                    , 0
                    , (float)(Math.PI / 2)
                    , 100
                    , 30
                    , -1
                    , true
                    , true
                    );
                    break;
                case PrebuiltEmitter.LargeBulletSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 80
                    , 0
                    , ParticleDeathMode.Seconds
                    , 0.75f
                    , 24
                    , 0.8f
                    , 0.3f
                    , new Color(0, 0, 0, 255)
                    , new Color(0, 0, 0, 0)
                    , ParticleRandType.Uniform
                    , 0.2f
                    , 0.1f
                    , 0.1f
                    , 75
                    , 0
                    , 0
                    , (float)(Math.PI)
                    , 100
                    , 70
                    , -1
                    , true
                    , true
                    );
                    break;
                case PrebuiltEmitter.MediumBulletSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 125
                    , 0
                    , ParticleDeathMode.Seconds
                    , 1f
                    , 0
                    , 0.6f
                    , 0.2f
                    , new Color(0, 0, 0, 255)
                    , new Color(0, 0, 0, 0)
                    , ParticleRandType.Uniform
                    , 0.2f
                    , 0.1f
                    , 0.2f
                    , 50
                    , 0
                    , 0
                    , (float)(Math.PI) / 3
                    , 75
                    , 40
                    , -1
                    , true
                    , true
                    );
                    break;
                case PrebuiltEmitter.PrisonerSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 75
                    , 0
                    , ParticleDeathMode.Seconds
                    , 3
                    , 0
                    , 0.5f
                    , 0.5f
                    , Color.White
                    , Color.White
                    , ParticleRandType.Uniform
                    , 0
                    , 0
                    , 0
                    , 0
                    , 0
                    , 0
                    , (float)(Math.PI * 2)
                    , 75
                    , -1
                    , 75
                    , false
                    , false
                    );
                    break;
                case PrebuiltEmitter.RocketBoostFire:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 60
                    , 0
                    , ParticleDeathMode.Distance
                    , 20
                    , 0
                    , 0.5f
                    , 0.1f
                    , new Color(255, 0, 0, 255)
                    , new Color(255, 160, 0, 50)
                    , ParticleRandType.Gaussian
                    , 0.2f
                    , 0.05f
                    , 5
                    , 15
                    , 0.25f
                    , 0
                    , (float)(Math.PI / 2)
                    , 100
                    , 50
                    , -1
                    , true
                    , true
                    );
                    break;
                case PrebuiltEmitter.SmallBulletSparks:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 100
                    , 0
                    , ParticleDeathMode.Seconds
                    , 1f
                    , 0
                    , 0.4f
                    , 0.2f
                    , new Color(0, 0, 0, 255)
                    , new Color(0, 0, 0, 0)
                    , ParticleRandType.Uniform
                    , 0.2f
                    , 0.1f
                    , 0.2f
                    , 50
                    , 0
                    , 0
                    , (float)(Math.PI / 8)
                    , 50
                    , 30
                    , -1
                    , true
                    , true
                    );
                    break;
                case PrebuiltEmitter.FlameFire:
                    e = new Emitter(TextureManager.Get("circle")
                    , new Vector2(0, 0)
                    , 40
                    , 0
                    , ParticleDeathMode.Distance
                    , 12
                    , 0
                    , 0.1f
                    , 0.9f
                    , new Color(255, 0, 0, 255)
                    , new Color(255, 70, 0, 0)
                    , ParticleRandType.Uniform
                    , 0.1f
                    , 0.2f
                    , 4f
                    , 0
                    , 0.25f
                    , 0.25f
                    , (float)(2 * Math.PI)
                    , 400
                    , 500
                    , -1
                    , true
                    , true
                    );
                    break;
            }
            return e;
        }
예제 #15
0
        public override void Update(GameTime gameTime)
        {
            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);
            rescueTimer += seconds * hero.powerupCooldownModifier; //keeps track of cooldown

            if (rescueEmitter == null)
            {
                initializeRescueEmitter();
                rescueEmitter.active = false;
            }
            else
            {
                if (!rescueEmitter.active)
                    rescueEmitter.position = hero.position; //updates particle emitter
                rescueEmitter.Update(gameTime);
                if (rescueEmitter.isFinished())
                    rescueEmitter = null;
            }

            if (endEmitter == null)
            {
                initializeEndEmitter();
            }
            else
            {
                endEmitter.Update(gameTime);
                if (endEmitter.isFinished())
                    endEmitter = null;
            }
        }
예제 #16
0
 private void initializeRescueEmitter()
 {
     rescueEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.CollectedSparks);
     //blinkEmitter.startColor = Color.Red;
     //blinkEmitter.endColor = Color.Purple;
     rescueEmitter.active = false;
 }
예제 #17
0
 private void initializeBlinkEmitter()
 {
     blinkEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.BlinkOriginSparks);
     //blinkEmitter.startColor = Color.Red;
     //blinkEmitter.endColor = Color.Purple;
     blinkEmitter.active = false;
 }