public object HandlePacket(PacketTriggerAnimation packet, IPropertyBag propertyBag = null, IStateMachine gameInstance = null) { if (propertyBag == null) { return(null); } propertyBag.PlayerContainer.ConstructionGunAnimation = packet.AnimationTime; if (propertyBag.PlayerContainer.ConstructionGunAnimation <= -0.1) { propertyBag.PlaySound(InfiniminerSound.RadarSwitch); } return(null); }
public object HandlePacket(PacketPlayerDead packet, IPropertyBag propertyBag = null, IStateMachine gameInstance = null) { if (propertyBag == null || !propertyBag.PlayerList.ContainsKey(packet.PlayerId)) { return(null); } var player = propertyBag.PlayerList[packet.PlayerId]; player.Alive = false; propertyBag.GetEngine <IParticleEngine>("particleEngine").CreateBloodSplatter(player.Position, player.Team == PlayerTeam.Red ? Color.Red : Color.Blue); if (packet.PlayerId != propertyBag.PlayerContainer.PlayerMyId) { propertyBag.PlaySound(InfiniminerSound.Death, player.Position); } return(null); }
public object HandlePacket(PacketTriggerExplosion packet, IPropertyBag propertyBag = null, IStateMachine gameInstance = null) { if (propertyBag == null) { return(null); } // Play the explosion sound. propertyBag.PlaySound(InfiniminerSound.Explosion, packet.BlockPos); // Create some particles. propertyBag.GetEngine <IParticleEngine>("particleEngine").CreateExplosionDebris(packet.BlockPos); // Figure out what the effect is. var distFromExplosive = (packet.BlockPos + 0.5f * Vector3.One - propertyBag.PlayerContainer.PlayerPosition).Length(); if (distFromExplosive < 3) { propertyBag.KillPlayer(Defines.deathByExpl); //"WAS KILLED IN AN EXPLOSION!"); } else if (distFromExplosive < 8) { // If we're not in explosion mode, turn it on with the minimum ammount of shakiness. if (propertyBag.PlayerContainer.ScreenEffect != ScreenEffect.Explosion) { propertyBag.PlayerContainer.ScreenEffect = ScreenEffect.Explosion; propertyBag.PlayerContainer.ScreenEffectCounter = 2; } // If this bomb would result in a bigger shake, use its value. propertyBag.PlayerContainer.ScreenEffectCounter = Math.Min(propertyBag.PlayerContainer.ScreenEffectCounter, (distFromExplosive - 2) / 5); } return(null); }