audiochorusfilter.playclipatpoint 在指定位置播放剪辑

2015-1-3 14:37| 发布者: 杨炎| 查看: 2666| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: audiosource.playclipatpoint 在指定位置播放剪辑static functionplayclipatpoint(clip:audioclip,position:vector3,volume: float = 1.0f) : voiddescription描述plays the clip at position. automatically cleans ...

audiosource.playclipatpoint 在指定位置播放剪辑

static functionplayclipatpoint(clip:audioclip,position:vector3,volume: float = 1.0f) : void

description描述

plays the clip at position. automatically cleans up the audio source after it has finished playing.

在指定位置播放剪辑。播放完成后自动消除音频源。

the audio source that is playing the sound is returned

正在播放声音的音频源被返回。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publicaudioclipclip;

void awake() {

audiosource.playclipatpoint(clip, newvector3(5, 1, 2));

}

}

// plays the clip at position

//在指定位置播放剪辑

var clip :audioclip;

audiosource.playclipatpoint(clip,vector3(5, 1, 2));

if you want further control over playback, you can use the following code instead.

如果想进一步控制播放,可以使用下面代码。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publicaudiocliptheclip;

audiosource playaudioclip(audioclipclip,vector3position, float volume) {

gameobjectgo = newgameobject("one shot audio");

go.transform.position = position;

audiosource source = go.addcomponent();

source.clip = clip;

source.volume = volume;

source.play();

destroy(go, clip.length);

return source;

}

void awake() {

playaudioclip(theclip, transform.position, 1);

}

}

var theclip :audioclip;

playaudioclip(theclip, transform.position, 1);

function playaudioclip (clip :audioclip, position :vector3, volume : float) {

var go = newgameobject("one shot audio");

go.transform.position = position;

var source : audiosource = go.addcomponent (audiosource);

source.clip = clip;

source.volume = volume;

source.play ();

destroy (go, clip.length);

return source;

}

相关阅读

文章点评
相关文章