Server.Effects.PlaySound C# (CSharp) Méthode

PlaySound() public static méthode

public static PlaySound ( IPoint3D p, Server.Map map, int soundID ) : void
p IPoint3D
map Server.Map
soundID int
Résultat void
		public static void PlaySound( IPoint3D p, Map map, int soundID )
		{
			if ( soundID <= -1 )
				return;

			if ( map != null )
			{
				Packet playSound = null;

				IPooledEnumerable eable = map.GetClientsInRange( new Point3D( p ) );

				foreach ( NetState state in eable )
				{
					state.Mobile.ProcessDelta();

					if ( playSound == null )
						playSound = Packet.Acquire( new PlaySound( soundID, p ) );

					state.Send( playSound );
				}

				Packet.Release( playSound );

				eable.Free();
			}
		}

Usage Example

Exemple #1
0
        public void CorpseExplosion(Mobile from)
        {
            if (this == null)
            {
                return;
            }
            if (from == null)
            {
                return;
            }

            int bodyParts = 20;

            int minRadius = 1;
            int maxRadius = 8;

            List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, true, false, Location, Map, bodyParts, 20, minRadius, maxRadius, false);

            if (m_ValidLocations.Count == 0)
            {
                return;
            }

            m_NextUseAllowed = DateTime.UtcNow + UsageCooldown;

            for (int a = 0; a < bodyParts; a++)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(a * .025), delegate
                {
                    if (this == null)
                    {
                        return;
                    }
                    if (this.Deleted)
                    {
                        return;
                    }

                    Point3D newLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)];

                    Effects.PlaySound(newLocation, Map, 0x4F1);

                    IEntity effectStartLocation = new Entity(Serial.Zero, Location, Map);
                    IEntity effectEndLocation   = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 2), Map);

                    int itemId = Utility.RandomList
                                 (
                        7389, 7397, 7398, 7395, 7402, 7408, 7407, 7393, 7584, 7405, 7585, 7600, 7587, 7602, 7394,
                        7404, 7391, 7396, 7399, 7403, 7406, 7586, 7599, 7588, 7601, 7392, 7392, 7583, 7597, 7390
                                 );

                    Effects.SendMovingEffect(effectStartLocation, effectEndLocation, itemId, 5, 0, false, false, 0, 0);

                    double distance = Utility.GetDistanceToSqrt(Location, newLocation);

                    double destinationDelay = (double)distance * .16;
                    double explosionDelay   = ((double)distance * .16) + 1;

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        new Blood().MoveToWorld(new Point3D(newLocation.X + Utility.RandomMinMax(-1, 1), newLocation.Y + Utility.RandomMinMax(-1, 1), newLocation.Z + 2), Map);
                        Effects.SendLocationParticles(EffectItem.Create(newLocation, Map, TimeSpan.FromSeconds(2.0)), itemId, 0, 50, 0, 0, 5029, 0);
                    });

                    Timer.DelayCall(TimeSpan.FromSeconds(explosionDelay), delegate
                    {
                        DetonateCorpse(newLocation, Map);
                    });
                });
            }
        }
All Usage Examples Of Server.Effects::PlaySound