protected override void updateAttack() { if (isAttackAnimDone && attackWait < This.gameTime.TotalGameTime) { attackWait = This.gameTime.TotalGameTime + new TimeSpan(0, 0, This.Game.rand.Next(2, 5)); int AttackChoice = This.Game.rand.Next(7); if (AttackChoice <= 0 && OuterCrystals.Count > 0) { foreach (Crystal c in OuterCrystals) { mAttacks.Add(Attacks.LightningSpan(c, this, 5, 0).GetEnumerator()); } } else if (AttackChoice <= 1 && OuterCrystals.Count > 0) { Crystal target = OuterCrystals.GetRandomElement(); if (target != null) { mAttacks.Add(Attacks.LightningSpan(target, this, 7, 0).GetEnumerator()); } } else if (AttackChoice <= 2) { AttackRotation rot; if (This.Game.rand.Next(2) == 0) { rot = AttackRotation.Clockwise; } else { rot = AttackRotation.CounterClockwise; } foreach (Crystal c in OuterCrystals) { mAttacks.Add(Attacks.LightningSpan(c, this, 7, 0, rotation: rot).GetEnumerator()); } } else { attackStartTime = This.gameTime.TotalGameTime; Effect particleEffect = This.Game.CurrentLevel.GetEffect("ParticleSystem"); Texture2D lightning = This.Game.CurrentLevel.GetTexture("sparkball"); foreach (TimeSpan delay in new TimeSpan[] { TimeSpan.Zero, new TimeSpan(0, 0, 0, 0, 500), new TimeSpan(0, 0, 1), }) { Sprite target = (This.Game.CurrentLevel as FrostbyteLevel).allies.Where(x => x.State != SpriteState.Dead).GetRandomElement(); ParticleEmitter particleEmitterLightning = new ParticleEmitter(1000, particleEffect, lightning); particleEmitterLightning.effectTechnique = "FadeAtXPercent"; particleEmitterLightning.fadeStartPercent = .98f; particleEmitterLightning.blendState = BlendState.Additive; (particleEmitterLightning.collisionObjects.First() as Collision_BoundingCircle).Radius = 10; (particleEmitterLightning.collisionObjects.First() as Collision_BoundingCircle).createDrawPoints(); particleEmitters.Add(particleEmitterLightning); mAttacks.Add(LevelFunctions.DelayEnumerable <bool>(Attacks.LightningProjectile(target, currentCrystal, 5, 0, new TimeSpan(0, 0, 0, 5), int.MaxValue, 2.5f, true, delegate(OurSprite attacker, Vector2 direction, float projectileSpeed, ParticleEmitter particleEmitter) { Vector2 tangent = new Vector2(-direction.Y, direction.X); for (int i = -5; i < 6; i++) { particleEmitter.createParticles(-direction * projectileSpeed * 5, tangent * -i * 40, particleEmitter.GroundPos + tangent * i * ParticleEmitter.EllipsePerspectiveModifier - direction * (Math.Abs(i) * 7), 4, 300); } }, particleEmitterLightning, Vector2.Zero), delay).GetEnumerator()); } } } }
protected override void updateAttack() { FrostbyteLevel l = (This.Game.CurrentLevel as FrostbyteLevel); Sprite currentTarget = GetClosestTarget(l.allies); int attackFrame = 0; if (attackWait < This.gameTime.TotalGameTime) { int randAttack = This.Game.rand.Next(14); if (randAttack < 10) { #region Fire Tier 1 int attackRange = 11; //Create Earth Tier 1 Particle Emmiter Effect particleEffect = l.GetEffect("ParticleSystem"); Texture2D snowflake = l.GetTexture("fireParticle"); foreach (TimeSpan delay in new TimeSpan[] { TimeSpan.Zero, new TimeSpan(0, 0, 0, 0, 500), new TimeSpan(0, 0, 1), }) { ParticleEmitter particleFireTier1 = new ParticleEmitter(500, particleEffect, snowflake); particleFireTier1.effectTechnique = "FadeAtXPercent"; particleFireTier1.fadeStartPercent = .98f; particleFireTier1.blendState = BlendState.Additive; (particleFireTier1.collisionObjects.First() as Collision_BoundingCircle).Radius = attackRange; (particleFireTier1.collisionObjects.First() as Collision_BoundingCircle).createDrawPoints(); particleEmitters.Add(particleFireTier1); mAttacks.Add(LevelFunctions.DelayEnumerable <bool>(Attacks.T1Projectile(currentTarget, this, 20, attackFrame, new TimeSpan(0, 0, 0, 1, 150), attackRange, 9f, false, delegate(OurSprite attacker, Vector2 direction, float projectileSpeed, ParticleEmitter particleEmitter) { Random randPosition = new Random(); particleEmitter.createParticles(direction * projectileSpeed, Vector2.Zero, particleEmitter.GroundPos, 10, 10); Vector2 tangent = new Vector2(-direction.Y, direction.X); for (int i = -5; i < 6; i++) { particleEmitter.createParticles(-direction * projectileSpeed * .75f, tangent * -i * 40, particleEmitter.GroundPos + tangent * i * ParticleEmitter.EllipsePerspectiveModifier + (float)randPosition.NextDouble() * direction * 8f, 10.0f, This.Game.rand.Next(10, 300)); } }, particleFireTier1, new Vector2(0, -38), Element.Fire ), delay).GetEnumerator()); } This.Game.AudioManager.PlaySoundEffect("Effects/Fire_T1"); #endregion Fire Tier 1 } else if (randAttack < 11) { #region Fire Tier 3 mAttacks.Add(Attacks.FirePillar(currentTarget, this, 30, attackFrame, Element.Fire).GetEnumerator()); This.Game.AudioManager.PlaySoundEffect("Effects/Fire_T3"); #endregion Fire Tier 3 } else if (randAttack < 14) { mAttacks.Add(Attacks.RammingAttack(currentTarget, this, 5, new TimeSpan(0, 0, 0, 0, 500)).GetEnumerator()); } attackWait = This.gameTime.TotalGameTime + new TimeSpan(0, 0, This.Game.rand.Next(5, 8)); } }
protected override void updateAttack() { if (attackWait < This.gameTime.TotalGameTime) { if (isAttackAnimDone && !IsSubmerged) { if (HasVomited || This.Game.rand.Next(4) != 0) { #region Spew List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies; Sprite target = GetClosestTarget(targets); if (target != null) { int attackRange = 11; //Create Particle Emitter Effect particleEffect = This.Game.CurrentLevel.GetEffect("ParticleSystem"); Texture2D boulder = This.Game.CurrentLevel.GetTexture("boulder"); foreach (TimeSpan delay in new TimeSpan[] { TimeSpan.Zero, new TimeSpan(0, 0, 0, 1, 500), new TimeSpan(0, 0, 3), }) { ParticleEmitter particleEmitterEarth = new ParticleEmitter(1000, particleEffect, boulder); particleEmitterEarth.effectTechnique = "NoSpecialEffect"; particleEmitterEarth.blendState = BlendState.AlphaBlend; (particleEmitterEarth.collisionObjects.First() as Collision_BoundingCircle).Radius = attackRange; (particleEmitterEarth.collisionObjects.First() as Collision_BoundingCircle).createDrawPoints(); particleEmitters.Add(particleEmitterEarth); Vector2 oldDirection = Direction; double angle = Math.Atan2(Direction.Y, Direction.X); SpriteFrame frame = GetAnimation(); for (int x = 0; x < 3; x++) { mAttacks.Add(LevelFunctions.DelayEnumerable <bool>(Attacks.T1Projectile(target, this, 5, 20, new TimeSpan(0, 0, 0, 1, 750), attackRange, 6f, false, delegate(OurSprite attacker, Vector2 direction, float projectileSpeed, ParticleEmitter particleEmitter) { Random randPosition = new Random(); particleEmitter.createParticles(direction * projectileSpeed, Vector2.Zero, particleEmitterEarth.GroundPos, 10, 10); Vector2 tangent = new Vector2(-direction.Y, direction.X); for (int i = -5; i < 6; i++) { particleEmitter.createParticles(-direction * projectileSpeed * 5, tangent * -i * 40, particleEmitter.GroundPos + tangent * i * ParticleEmitter.EllipsePerspectiveModifier + (float)randPosition.NextDouble() * direction * 8f, 1.5f, 300); } }, particleEmitterEarth, new Vector2(0, -20)), delay).GetEnumerator()); } } } #endregion } else { SetAnimation(18); mAttacks.Add(Attacks.WormVomit(this, 18, 1, 24).GetEnumerator()); HasVomited = true; } } attackWait = This.gameTime.TotalGameTime + new TimeSpan(0, 0, rng.Next(1, 3)); } }