GameEntities.WaterPlane.CreateSplash C# (CSharp) Method

CreateSplash() public method

public CreateSplash ( WaterPlaneType splashType, Vec3 pos ) : void
splashType WaterPlaneType
pos Vec3
return void
        public void CreateSplash( WaterPlaneType.SplashTypes splashType, Vec3 pos )
        {
            //get items array for this alias
            WaterPlaneType.SplashItem[] items = GetSplashItemsByType( splashType );
            if( items.Length == 0 )
                return;

            //random choose item
            WaterPlaneType.SplashItem item = items[ World.Instance.Random.Next( items.Length ) ];

            //create particle systems
            foreach( WaterPlaneType.SplashItem.ParticleItem particleItem in item.Particles )
            {
                Map.Instance.CreateFreeParticleSystem( particleItem.ParticleName, pos, Quat.Identity,
                    new Vec3( particleItem.Scale, particleItem.Scale, particleItem.Scale ) );
            }

            //play sound
            if( !string.IsNullOrEmpty( item.SoundName ) )
            {
                Sound sound = SoundWorld.Instance.SoundCreate( item.SoundName, SoundMode.Mode3D );
                if( sound != null )
                {
                    VirtualChannel channel = SoundWorld.Instance.SoundPlay( sound,
                        EngineApp.Instance.DefaultSoundChannelGroup, .5f, true );
                    if( channel != null )
                    {
                        channel.Position = pos;
                        channel.Pause = false;
                    }
                }
            }

            if( EntitySystemWorld.Instance.IsServer() )
                Server_SendCreateSplashToAllClients( splashType, pos );
        }