【发布时间】:2015-12-02 13:03:42
【问题描述】:
我正在尝试创建一个随机生成对象的脚本,不幸的是我的脚本运行得不是很好。你能帮我随机化游戏对象生成之间的时间吗?谢谢!
#pragma strict
var SpawnObject : GameObject;
var SpawnPoint : GameObject;
var SpawnCounter : int = 0;
var SpawnCounterMinMax : int =0;
var SpawnCounterMaxMax : int =0;
function Update ()
{
var float_min_bother_I_hate_you_js : float = this.SpawnCounterMinMax;
var float_max_bother_I_hate_you_js : float = this.SpawnCounterMaxMax;
var SpawnCounterMax = Random.Range(float_min_bother_I_hate_you_js, float_max_bother_I_hate_you_js);
this.SpawnCounter++;
if (this.SpawnCounter >= SpawnCounterMax )
{
Instantiate(this.SpawnObject, this.SpawnPoint.transform.position, this.SpawnPoint.transform.rotation );
this.SpawnCounter = 0;
SpawnCounterMax = Random.Range(float_min_bother_I_hate_you_js, float_max_bother_I_hate_you_js);
}
}
【问题讨论】:
标签: random unity3d scripting unityscript