您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

29 行
602 B

using UnityEngine;
using System.Collections;
public class BoxSpawner : MonoBehaviour
{
public GameObject boxTemplate;
private float elapsed;
// Use this for initialization
void Start()
{
elapsed = 0;
}
// Update is called once per frame
void Update()
{
elapsed += Time.deltaTime;
if (elapsed > 1)
{
elapsed = 0;
var go = Instantiate(boxTemplate);
var pos = new Vector2(Random.Range(-5.0f, 5.0f), 7.0f);
go.transform.position = pos;
Destroy(go, 10.0f);
}
}
}