AudioSource.pitch 音调

var pitch : float

Description描述

The pitch of the audio source.

音频源的音调。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public int startingPitch = 4;
	public int timeToDecrease = 5;
	void Start() {
		audio.pitch = startingPitch;
	}
	void Update() {
		if (audio.pitch > 0)
			audio.pitch -= Time.deltaTime * startingPitch / timeToDecrease;

	}
}
// Decreases the pitch in the given seconds
//在给定的秒数降低音调

var startingPitch = 4;
var timeToDecrease = 5;

function Start() {
	audio.pitch = startingPitch;
}

function Update() {
	if(audio.pitch > 0)
		audio.pitch -= ((Time.deltaTime * startingPitch) / timeToDecrease);
}
最后修改:2011年4月5日 Tuesday 11:08

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。