void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { if (Owner.Deleted) { return; } var sourceLocation = eventArgs.Source; var targetLocation = eventArgs.Target.Transform.Coordinates; if (sourceLocation.Equals(targetLocation)) { return; } var direction = (targetLocation.ToMapPos(Owner.EntityManager) - sourceLocation.ToMapPos(Owner.EntityManager)).Normalized; var throwForce = eventArgs.Severity switch { ExplosionSeverity.Heavy => 30, ExplosionSeverity.Light => 20, _ => 0, }; Owner.TryThrow(direction, throwForce); }
public void OnExplosion(ExplosionEventArgs eventArgs) { var sourceLocation = eventArgs.Source; var targetLocation = eventArgs.Target.Transform.GridPosition; var dirVec = (targetLocation.ToMapPos(_mapManager) - sourceLocation.ToMapPos(_mapManager)).Normalized; var throwForce = 1.0f; switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: throwForce = 3.0f; break; case ExplosionSeverity.Heavy: throwForce = 2.0f; break; case ExplosionSeverity.Light: throwForce = 1.0f; break; } ThrowHelper.Throw(Owner, throwForce, targetLocation, sourceLocation, true); }
public void OnExplosion(ExplosionEventArgs eventArgs) { var sourceLocation = eventArgs.Source; var targetLocation = eventArgs.Target.Transform.Coordinates; var dirVec = (targetLocation.ToMapPos(Owner.EntityManager) - sourceLocation.ToMapPos(Owner.EntityManager)).Normalized; float throwForce; switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: throwForce = 30.0f; break; case ExplosionSeverity.Heavy: throwForce = 20.0f; break; default: throwForce = 10.0f; break; } Owner.TryThrow(dirVec * throwForce); }
private void OnExplosion(object sender, ExplosionEventArgs e) { Application.Current.Dispatcher.Invoke(() => { _mapControl.MapArea.Children.Add(new ExplosionControl(e.Tile)); }); }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { if (_entMan.Deleted(Owner)) { return; } var sourceLocation = eventArgs.Source; var targetLocation = _entMan.GetComponent <TransformComponent>(eventArgs.Target).Coordinates; if (sourceLocation.Equals(targetLocation)) { return; } var offset = (targetLocation.ToMapPos(_entMan) - sourceLocation.ToMapPos(_entMan)); //Don't throw if the direction is center (0,0) if (offset == Vector2.Zero) { return; } var direction = offset.Normalized; var throwForce = eventArgs.Severity switch { ExplosionSeverity.Heavy => 30, ExplosionSeverity.Light => 20, _ => 0, }; Owner.TryThrow(direction, throwForce); }
private void ExplosionHandler(object sender, ExplosionEventArgs args) { var entry = new GameObjectExplodedLogItem(Timestamp.Create(), args.Exploded.Id.Value); // marks as depritiated right now - this event has not to be transferred to new players entry.IsDepriciated = true; m_worldEventsLog.AddEntry(entry); }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: case ExplosionSeverity.Heavy: PerformDestruction(); break; case ExplosionSeverity.Light: if (_random.Prob(0.5f)) { PerformDestruction(); } break; } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { if (eventArgs.Severity < ExplosionSeverity.Heavy) { return; } var storedEntities = storage.ContainedEntities.ToList(); foreach (var entity in storedEntities) { var exActs = entity.GetAllComponents <IExAct>(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); } } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { if (eventArgs.Severity < ExplosionSeverity.Heavy) { return; } foreach (var slot in SlotContainers.Values.ToList()) { foreach (var entity in slot.ContainedEntities) { var exActs = entity.GetAllComponents <IExAct>().ToList(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); } } } }
public void RemoveShotByImpact(int bzfsID) { Shot s = GetShotByBZFSID(bzfsID); if (s == null) { return; } RemoveShotByGID(s.GlobalID); if (ExplosionCreated != null) { ExplosionEventArgs args = new ExplosionEventArgs(); args.Position = s.Position; args.LastVelocity = s.Velocity; args.Reson = ExplosionEventArgs.Reasons.ImpactEnd; ExplosionCreated.Invoke(this, args); } }
public void OnExplosion(ExplosionEventArgs eventArgs) { var prob = new Random(); switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: _actSystem.HandleBreakage(Owner); break; case ExplosionSeverity.Heavy: _actSystem.HandleBreakage(Owner); break; case ExplosionSeverity.Light: if (prob.Prob(40)) { _actSystem.HandleBreakage(Owner); } break; } }
public void OnExplosion(ExplosionEventArgs eventArgs) { var prob = IoCManager.Resolve <IRobustRandom>(); switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: _actSystem.HandleBreakage(Owner); break; case ExplosionSeverity.Heavy: _actSystem.HandleBreakage(Owner); break; case ExplosionSeverity.Light: if (prob.Prob(0.4f)) { _actSystem.HandleBreakage(Owner); } break; } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { var prob = new Random(); switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: _actSystem.HandleDestruction(Owner, false); break; case ExplosionSeverity.Heavy: _actSystem.HandleDestruction(Owner, true); break; case ExplosionSeverity.Light: if (RandomExtensions.Prob(prob, 40)) { _actSystem.HandleDestruction(Owner, true); } break; } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { var prob = IoCManager.Resolve <IRobustRandom>(); switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: _actSystem.HandleDestruction(Owner, false); break; case ExplosionSeverity.Heavy: _actSystem.HandleDestruction(Owner, true); break; case ExplosionSeverity.Light: if (prob.Prob(40)) { _actSystem.HandleDestruction(Owner, true); } break; } }
public void HandleShotEnd(NetworkMessage msg) { MsgShotEnd se = msg as MsgShotEnd; Shot s = GetShotByBZFSID(BuildBZFSShotID(se.PlayerID, se.ShotID)); if (s == null) { return; } RemoveShotByGID(s.GlobalID); if (ExplosionCreated != null) { ExplosionEventArgs args = new ExplosionEventArgs(); args.Position = s.Position; args.LastVelocity = s.Velocity; args.Reson = se.Exploded ? ExplosionEventArgs.Reasons.ImpactEnd : ExplosionEventArgs.Reasons.LifetimeEnd; ExplosionCreated.Invoke(this, args); } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { if (eventArgs.Severity < ExplosionSeverity.Heavy) { return; } if (EntitySystem.Get <InventorySystem>() .TryGetContainerSlotEnumerator(Owner, out var enumerator, this)) { while (enumerator.MoveNext(out var container)) { if (!container.ContainedEntity.HasValue) { continue; } foreach (var exAct in _entityManager.GetComponents <IExAct>(container.ContainedEntity.Value).ToArray()) { exAct.OnExplosion(eventArgs); } } } }
void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { var burnDamage = 0; var bruteDamage = 0; switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: bruteDamage += 250; burnDamage += 250; break; case ExplosionSeverity.Heavy: bruteDamage += 60; burnDamage += 60; break; case ExplosionSeverity.Light: bruteDamage += 30; break; } Owner.GetComponent <DamageableComponent>().TakeDamage(DamageType.Brute, bruteDamage, null); Owner.GetComponent <DamageableComponent>().TakeDamage(DamageType.Heat, burnDamage, null); }
private void ConsoleMine_OnExplosion(IMine sender, ExplosionEventArgs args) { MessageBox.Show("Hit!"); }
private void ExplosionDetected(object sedner, ExplosionEventArgs args) { AddExplosion(args.Exploded); }
public void OnExplosionHappened(object source, ExplosionEventArgs e) { // GrenadeExplosion1.Play(0.5f, 0, 0); PlayRandomSound(GrenadeExplosion1, GrenadeExplosion2, GrenadeExplosion3); Explosion explosion = e.Explosion; //for (int i = 0; i < 10; i++) //{ // Emitter SparkEmitter = new Emitter(RoundSparkTexture, // new Vector2(explosion.Position.X, explosion.Position.Y), // new Vector2(0, 0), // new Vector2(1, 2), new Vector2(180 * 16, 200 * 16), 0.8f, true, new Vector2(0, 360), new Vector2(1, 3), // new Vector2(0.1f, 0.3f), Color.Orange, Color.OrangeRed, 0.05f, 0.5f, 10, 5, false, // new Vector2(explosion.Position.Y + 16, explosion.Position.Y + 16), null, 0, // false, false, new Vector2(3, 5), new Vector2(90 - 40, 90 + 40), 0.2f, true); // EmitterList.Add(SparkEmitter); //} Emitter ExplosionEmitter = new Emitter(ExplosionParticle2, new Vector2(explosion.Position.X, explosion.Position.Y + 16), new Vector2(20, 160), new Vector2(0.3f, 0.8f), new Vector2(500, 1000), 0.85f, true, new Vector2(-2, 2), new Vector2(-1, 1), new Vector2(0.15f, 0.25f), FireColor, Color.Black, -0.2f, 0.1f, 5, 1, false, new Vector2(0, 720), false, 0f, null, null, null, null, null, null, new Vector2(0.1f, 0.2f), true, true, null, null, null, true); EmitterList2.Add(ExplosionEmitter); Emitter ExplosionEmitter3 = new Emitter(ExplosionParticle2, new Vector2(explosion.Position.X, explosion.Position.Y + 16), new Vector2(85, 95), new Vector2(2, 4), new Vector2(400, 640), 0.35f, true, new Vector2(0, 0), new Vector2(0, 0), new Vector2(0.085f, 0.2f), FireColor, ExplosionColor3, -0.1f, 0.05f, 5, 1, false, new Vector2(0, 720), true, 0f, null, null, null, null, null, null, new Vector2(0.0025f, 0.0025f), true, true, 50); EmitterList2.Add(ExplosionEmitter3); //Emitter DebrisEmitter = new Emitter(SplodgeParticle, // new Vector2(explosion.Position.X, explosion.Position.Y), // new Vector2(70, 110), new Vector2(5, 7), new Vector2(480, 1760), 1f, true, new Vector2(0, 360), // new Vector2(1, 3), new Vector2(0.007f, 0.05f), Color.DarkSlateGray, Color.DarkSlateGray, // 0.2f, 0.2f, 5, 1, true, new Vector2(0, 720), null, 0f); //EmitterList.Add(DebrisEmitter); foreach (Player player in Players.Where(Player => Player != null)) { float dist = Vector2.Distance(new Vector2(player.DestinationRectangle.Center.X, player.DestinationRectangle.Center.Y), explosion.Position); if (dist < explosion.BlastRadius) { Gore1.Play(); player.CurrentHP = 0; for (int i = 0; i < 40; i++) { Vector2 myDir = new Vector2(player.DestinationRectangle.Center.X, player.DestinationRectangle.Center.Y) - explosion.Position; myDir.Normalize(); float angle = (float)Math.Atan2(myDir.Y, myDir.X) + MathHelper.ToRadians((float)RandomDouble(-130, 130)); Vector2 dir = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)); dir.Normalize(); Gib newGib = new Gib(Splodge, new Vector2(player.DestinationRectangle.Center.X, player.DestinationRectangle.Center.Y), dir, 10, RandomTexture(DecalTexture1, DecalTexture2, DecalTexture3, DecalTexture4), Splodge, Color.Maroon); newGib.CurrentLevel = Level1; GibList.Add(newGib); } if (e.Explosion.Source == player) { player.Score--; } else { (e.Explosion.Source as Player).Score++; } player.MakeRumble(250, new Vector2(0.9f, 0.1f)); } } }