0
我想在“由Unity提供动力”介绍之后加入一个介绍(如intro.jpg),并且我希望将介绍显示2秒钟。有没有办法在游戏开始之前进行简介?
我想在“由Unity提供动力”介绍之后加入一个介绍(如intro.jpg),并且我希望将介绍显示2秒钟。有没有办法在游戏开始之前进行简介?
我假设你的第一个场景叫做Game
。
创建一个名为“简介”的新场景。
在这个场景中,添加图像元素,并为其分配一个脚本:
using UnityEngine;
using System.Collections;
public class Intro : MonoBehaviour {
bool shouldGo = false;
float timeout = 2.0f;
void Update() {
if (shouldGo) {
timeout -= Time.deltaTime;
if (timeout <= 0.0f) Go();
return;
} else {
int percentageLoaded = (int)(Application.GetStreamProgressForLevel("Game") * 100.0f);
}
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
if (Application.CanStreamedLevelBeLoaded("Game")) shouldGo = true;
}
if (Input.GetMouseButtonDown(0)) {
if (Application.CanStreamedLevelBeLoaded("Game")) shouldGo = true;
}
}
void Go() {
Application.LoadLevel("Game");
}
}
然后在Build Settings
,添加新的Introduction
现场,并通过拖动列表的顶部移动到0位置。
谢谢。下次我会在尝试之前尝试。谢谢! – PanaitStudio
请下次尝试之前发布,让我们知道你的尝试。检查http://stackoverflow.com/help/how-to-ask – Kaiido