public override void UpdateGameState(GameTime gameTime) { if (_explosion == null && gameTime.TotalGameTime > TimeSpan.FromSeconds(2)) { _explosion = new ExplosionEmitter(LoadTexture(CloudTexture), new Vector2(260, 60)); AddGameObject(_explosion); _explodeAt = gameTime.TotalGameTime; } if (_explosion != null && gameTime.TotalGameTime - _explodeAt > TimeSpan.FromSeconds(1.2)) { _explosion.Deactivate(); } if (_explosion != null && gameTime.TotalGameTime - _explodeAt > TimeSpan.FromSeconds(0.5)) { RemoveGameObject(_chopper); } if (_explosion != null && gameTime.TotalGameTime > TimeSpan.FromSeconds(10)) { RemoveGameObject(_explosion); } if (_explosion != null) { _explosion.Update(gameTime); } }
private void AddExplosion(Vector2 position) { var explosion = new ExplosionEmitter(_explosionTexture, position); AddGameObject(explosion); _explosionList.Add(explosion); }
// Use this for initialization void Start() { damage = GetComponent <Damagable>(); //damage.MyOnDeath = null; damage.MyOnDeath -= damage.OnDeath; damage.MyOnDeath += Explode; emitter = GetComponent <ExplosionEmitter>(); }
void OnTriggerEnter2D(Collider2D collider) { ExplosionEmitter.Emit(transform.position); Destroy(gameObject); BeatValue.AddScore(1); var bullet = collider.gameObject.GetComponent <Bullet>(); if (bullet != null) { bullet.GetPlayer().AddReward(); } }
public void CreateExplosionAt(Vector3 position, Color color, ParticleEffectSize size) { if (setupExplosionCalled == false) { SetupExplosionEmitter(); setupExplosionCalled = true; } Position = position; var scale = explosionScale[size]; ExplosionEmitter.SetEmissionColor(color); ExplosionEmitter.NumberPerEmission = DefaultNumberPerEmission * scale; ExplosionEmitter.EmissionSettings.ScaleY = DefaultMinScale * scale; ExplosionEmitter.EmissionSettings.ScaleYRange = (DefaultMaxScale - DefaultMinScale) * scale; ExplosionEmitter.EmissionSettings.RadialVelocity = DefaultMinVelocity * scale; ExplosionEmitter.EmissionSettings.RadialVelocityRange = (DefaultMaxVelocity - DefaultMinVelocity) * scale; ExplosionEmitter.Emit(); }
public Bomb(EntityState es, string name, XmlParser xp) : base(es, name) { string path = es.Name + "->" + "Bomb"; Name = Name + ID; Body = new Body(this, "Body"); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); Collision = new Collision(this, "Collision"); Collision.CollideEvent += CollisionHandler; AddComponent(Collision); ImageRender = new ImageRender(this, "ImageRender"); AddComponent(ImageRender); _explodeanim = new Animation(this, "ExplodeAnim"); _explodeanim.LastFrameEvent += Destroy; AddComponent(_explodeanim); _explodesound = new Sound(this, "ExplodeSound"); AddComponent(_explodesound); _explosionemitter = new ExplosionEmitter(this); AddComponent(_explosionemitter); _smokeemitter = new SmokeEmitter(this); AddComponent(_smokeemitter); ParseXml(xp, path); //TODO: Hook up Collision.CollideEvent to a handler _explodeanim.Origin = new Vector2(_explodeanim.TileSize.X / 2.0f, _explodeanim.TileSize.Y / 2.0f); ImageRender.Origin = new Vector2(ImageRender.Texture.Width / 2f, ImageRender.Texture.Height / 2f); }