Exemple #1
0
 public override void Activate(InputAction activationAction)
 {
     base.Activate(activationAction);
     if (bulletTimer < BULLET_BASIC_FIRE_INTERVAL)
         return;
     bulletTimer = 0;
     Bullet b = new Bullet(this, "chargebullet1", PrebuiltEmitter.SmallBulletSparks, EMITTER_BASIC_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_BASIC * damageModifier));
     b.scale = BULLET_BASIC_SCALE;
     b.hitbox.originalRectangle.Height = BULLET_SIZE;
     b.hitbox.originalRectangle.Width = BULLET_SIZE;
     b.position = new Vector2(hero.position.X, hero.position.Y);
     b.explosionEmitter.startSize = 0.25f;
     b.explosionEmitter.endSize = 0.25f;
     ammo.Add(b);
     shotFired = true;
 }
Exemple #2
0
        public override void Update(GameTime gameTime)
        {
            base.PreUpdate(gameTime);

            float seconds = gameTime.getSeconds(Hero.HERO_TIMESCALE);

            if (activated)
            {
                chargeTimer += seconds*hero.powerupCooldownModifier;
            }
            chargeEmitter.active = activated;
            if (chargeTimer < BULLET_CHARGE_TIME_SMALL)
            {
                chargeEmitter.active = false;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_SMALL && chargeTimer < BULLET_CHARGE_TIME_MEDIUM)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet1", PrebuiltEmitter.SmallBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_SMALL * damageModifier));
                    ammo.Add(b);
                    b.scale = BULLET_SMALL_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_SMALL_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_SMALL_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletTiny";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_SMALL_SCALE;
                Color c = CHARGE_COLOR_SMALL;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_MEDIUM && chargeTimer < BULLET_CHARGE_TIME_LARGE)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet2", PrebuiltEmitter.MediumBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_MEDIUM * damageModifier), true);
                    ammo.Add(b);
                    b.scale = BULLET_MEDIUM_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_MEDIUM_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_MEDIUM_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletLight";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_MEDIUM_SCALE;
                Color c = CHARGE_COLOR_MEDIUM;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }
            else if (chargeTimer >= BULLET_CHARGE_TIME_LARGE)
            {
                if (!activated)
                {
                    Bullet b = new Bullet(this, "chargebullet3", PrebuiltEmitter.LargeBulletSparks, EMITTER_CHARGE_COLOR, hero.direction, Bullet.DISTANCE_LIMIT_CHARGE, (int)(BULLET_DAMAGE_CHARGE_LARGE * damageModifier), true);
                    ammo.Add(b);
                    b.scale = BULLET_LARGE_SCALE;
                    b.hitbox.originalRectangle.Height = (int)(BASE_BULLET_SIZE * BULLET_LARGE_SCALE);
                    b.hitbox.originalRectangle.Width = (int)(BASE_BULLET_SIZE * BULLET_LARGE_SCALE);
                    b.position = new Vector2(hero.position.X, hero.position.Y);
                    b.explosionEmitter.startSize = 1f;
                    b.explosionEmitter.endSize = 1f;
                    chargeTimer = 0;

                    FiredSound = "BulletStrong";
                    shotFired = true;
                }
                chargeEmitter.startSize = CHARGE_PARTICLES_LARGE_SCALE;
                Color c = CHARGE_COLOR_LARGE;
                chargeEmitter.startColor = c;
                c.A = 255;
                chargeEmitter.endColor = c;
            }

            chargeEmitter.position = hero.position;
            if (seconds > 0)
            {
                chargeEmitter.Update(gameTime);
            }

            base.PostUpdate(gameTime);
        }
Exemple #3
0
 public BulletMemento(Bullet target)
 {
     Target = target;
     position = target.position;
     distance = target.distance;
     alreadyHit = target.enemiesAlreadyHit.ToArray();
     dying = target.dying;
     trailEmitterMemento = target.trailEmitter.GenerateMementoFromCurrentFrame();
     explosionEmitterMemento = target.explosionEmitter.GenerateMementoFromCurrentFrame();
 }