コード例 #1
0
    public override void Process(PlayFMODStudioEmitter packet)
    {
        GameObject            soundSource           = NitroxEntity.RequireObjectFrom(packet.Id);
        FMODEmitterController fmodEmitterController = soundSource.RequireComponent <FMODEmitterController>();

        using (packetSender.Suppress <PlayFMODStudioEmitter>())
        {
            if (packet.Play)
            {
                fmodEmitterController.PlayStudioEmitter(packet.AssetPath);
            }
            else
            {
                fmodEmitterController.StopStudioEmitter(packet.AssetPath, packet.AllowFadeout);
            }
        }
    }
コード例 #2
0
        public override void Process(PlayFMODStudioEmitter packet)
        {
            Optional <GameObject> soundSource = NitroxEntity.GetObjectFrom(packet.Id);

            Validate.IsPresent(soundSource);

            FMODEmitterController fmodEmitterController = soundSource.Value.GetComponent <FMODEmitterController>();

            Validate.IsTrue(fmodEmitterController);

            using (packetSender.Suppress <PlayFMODStudioEmitter>())
            {
                if (packet.Play)
                {
                    fmodEmitterController.PlayStudioEmitter(packet.AssetPath);
                }
                else
                {
                    fmodEmitterController.StopStudioEmitter(packet.AssetPath, packet.AllowFadeout);
                }
            }
        }