找回密碼
 注冊帳號

掃一掃,訪問微社區

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

2015-1-3 14:37| 發布者: 楊炎| 查看: 2778| 評論: 0|原作者: 蠻牛|來自: unity3d腳本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;

}

相關閱讀

文章點評
相關文章
女校游泳队彩金