public void Tick(SceneGame scene) { var sword = Curio.GetBehavior <BehaviorSword>(); var enflamed = Enflamed; if (sword != null /*&& sword.HasBlood*/) { FrameCharge += scene.TimeModCurrent; } else { Extinguish(); } if (Enflamed) { if (FrameVisual.Done) { if (sword != null) { var particle = new ExplosionParticle(scene, SpriteLoader.Instance.AddSprite("content/effect_explosion"), sword.GetBlade(8), Random.Next(10, 20)) { Angle = Curio.GetVisualAngle() + sword.VisualAngle() + Random.NextFloat(-0.3f, +0.3f), Color = Color.White, DrawPass = DrawPass.EffectAdditive, }; particle.Size.Set(Random.NextFloat(0.5f, 1.0f)); } FrameVisual.Reset(); } FrameVisual += scene.TimeModCurrent; } }
void Awake() { instance = this; Barrel.SetActive(true); BarrelMesh.SetActive(true); ExplosionParticle.SetActive(false); ExplosionArea.SetActive(false); }
IEnumerator ExplodeRoutine() { ExplosionParticle.SetActive(true); ExplosionArea.SetActive(true); BarrelMesh.SetActive(false); yield return(new WaitForSeconds(1.5f)); ExplosionParticle.SetActive(false); ExplosionArea.SetActive(false); Barrel.SetActive(false); }
public void GenerateAbsoluteExplosion(Game1 game, Sprite spriteSheet, GameObjectVertical source, int nbrPartices, float size, float speed = 1, int fragmentDur = 1, float fragmentSpeed = 1, bool randomDir = false) { Vector2 position = source.Position; Vector2 direction = source.Direction; ExplosionParticle[] tempParticleArray = new ExplosionParticle[nbrPartices]; for (int i = 0; i < nbrPartices; i++) { tempParticleArray[i] = new ExplosionParticle(game, spriteSheet, position, direction, speed, size, randomDir, i, fragmentSpeed, fragmentDur); } particleArray = tempParticleArray; }
public void Tick(SceneGame scene) { var exploded = ExplosionTime.Done; var active = Origin.GetActionHolder(ActionSlot.Active); var passive = Origin.GetActionHolder(ActionSlot.Passive); ExplosionTime += scene.TimeModCurrent; if (ExplosionTime.Done) { if (!exploded) { SkillUtil.CreateSpatter(scene, Target.GetVisualTarget(), 7, Vector2.Zero, 2, Random); new TimeFade(scene, 0.05f, LerpHelper.ExponentialIn, 40); for (float angle = 0; angle <= MathHelper.TwoPi; angle += MathHelper.TwoPi * 0.02f) { var particle = new ExplosionParticle(scene, SpriteLoader.Instance.AddSprite("content/effect_explosion"), Target.GetVisualTarget() + Util.AngleToVector(angle) * 8, Random.Next(5, 15)) { Angle = angle + Random.NextFloat(-0.3f, +0.3f), Color = Color.White, DrawPass = DrawPass.EffectAdditive, }; particle.Size.Set(Random.NextFloat(1.0f, 1.5f)); } var actions = new List <ActionWrapper>(); actions.Add(new ActionGib(Origin, Target, Score, SoundLoader.AddSound("content/sound/big_splat.wav")).InSlot(ActionSlot.Active)); actions.Apply(Target); var actionsOrigin = new List <ActionWrapper>() { new ActionKeepMoving(Origin).InSlot(ActionSlot.Active), }; actionsOrigin.Apply(Origin); } Time += scene.TimeModCurrent; } else { active.CurrentActions.RemoveAll(x => x is ActionKeepMoving); } }
private void UpdateFootstep(SceneGame scene) { var active = Curio.GetActionHolder(ActionSlot.Active); var tile = Curio.GetMainTile(); Footstep += scene.TimeModCurrent; if (Momentum.Amount >= 32 && Footstep >= 4 && tile != null && !tile.IsChasm() && active.CurrentActions.Any(CanFootstep)) { Footstep = Footstep % 4; var angle = Curio.GetVisualAngle(); var offset = Util.AngleToVector(angle); var lateral = Util.AngleToVector(angle + MathHelper.PiOver2); var particle = new ExplosionParticle(scene, SpriteLoader.Instance.AddSprite("content/effect_moon"), Curio.GetVisualTarget() + FootstepOffset * lateral * 6 + offset * -12, 20) { Angle = angle + MathHelper.Pi, Color = Color.White, DrawPass = DrawPass.EffectLowAdditive, }; //new ScreenShakeRandom(scene, 0.5f, 5, LerpHelper.QuadraticIn); FootstepOffset *= -1; } }
public override void Update() { if (_firingTimer.TimeElapsedInMilliSeconds > FiringInterval) { _firingTimer.Reset(); _isFiring = !_isFiring; } if (_isFiring) { if (_bulletSpacingTimer.TimeElapsedInMilliSeconds > BulletInterval) { if (_firingRight) { MachineGunParticle par = new MachineGunParticle(this, 8); ExplosionParticle exp = new ExplosionParticle(CollRectangle.X + 8, CollRectangle.Y, Color.White, .7f); GameWorld.Instance.Particles.Add(exp); GameWorld.Instance.Particles.Add(par); _firingSound.PlayNewInstanceOnce(); _firingSound.Reset(); _firingRight = !_firingRight; } else { MachineGunParticle par = new MachineGunParticle(this, 24); ExplosionParticle exp = new ExplosionParticle(CollRectangle.X + 24, CollRectangle.Y, Color.White,.7f); GameWorld.Instance.Particles.Add(exp); GameWorld.Instance.Particles.Add(par); _firingRight = !_firingRight; _firingSound.PlayNewInstanceOnce(); _firingSound.Reset(); } _bulletSpacingTimer.Reset(); } } base.Update(); }
protected override Particle GenerateNewParticle() { int index = _rand.Next(0, 3); int ttl = _rand.Next(50, 80); ExplosionParticle p = new ExplosionParticle(index, Entity.GetComponent<Body>().Position + Entity.GetComponent<Render>().Origin * Entity.GetComponent<Render>().Scale, ttl, this); p.Body.Angle = (float)_rand.NextDouble() - .5f*1.5f; p.Physics.Thrust(((float)_rand.NextDouble() + 1f) * 2.5f); p.TileRender.Layer = .5f; return p; }