您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
568 B
25 行
568 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[ClientOnlyComponent]
|
|
public class AmbientSoundEmitter : MonoBehaviour
|
|
{
|
|
public SoundDef sound;
|
|
|
|
SoundSystem.SoundHandle handle;
|
|
|
|
void Start()
|
|
{
|
|
// TODO (petera) remove if once we get null soundsystem. Headless check needed
|
|
// for headless clients
|
|
if(!Game.IsHeadless())
|
|
handle = Game.SoundSystem.Play(sound);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
if (!Game.IsHeadless())
|
|
Game.SoundSystem.Stop(handle, 4.0f);
|
|
}
|
|
}
|