Created
October 21, 2011 09:20
Revisions
-
geta6 created this gist
Oct 21, 2011 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ var interval : float; var redBoxPrefav : GameObject; var blueBoxPrefav : GameObject; private var isRed : boolean; private var nextTime : float; function Start () { isRed = true; nextTime = 0.0; } function Update () { nextTime -= Time.deltaTime; if (nextTime < 0.0) { var offsetX : float = Random.Range(-18.0, 18.0); var offsetZ : float = Random.Range(-12.0, 12.0); var position : Vector3 = transform.position + Vector3(offsetX, 0, offsetZ); var prefab : GameObject = isRed?redBoxPrefav:blueBoxPrefav; Instantiate(prefab, position, Random.rotation); nextTime = interval; isRed = !isRed; } }