|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
@ -6,20 +6,20 @@ using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class Game01 : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject rocket; // 火箭
|
|
|
|
|
public GameObject[] fires; // 成功发射的点火特效
|
|
|
|
|
public GameObject fog; // 失败时的冒烟特效
|
|
|
|
|
public GameObject rocket; // 火箭
|
|
|
|
|
public GameObject[] fires; // 成功发射的点火特效
|
|
|
|
|
public GameObject fog; // 失败时的冒烟特效
|
|
|
|
|
public GameObject panel;
|
|
|
|
|
|
|
|
|
|
private GameObject left;
|
|
|
|
|
private GameObject right;
|
|
|
|
|
|
|
|
|
|
private bool fired = false; // 是否点火成功
|
|
|
|
|
private float pretime = 3f; // 准备时间
|
|
|
|
|
private float timestamp = 0f; // 冷却时间
|
|
|
|
|
private float wait = 1f; // 等待时间
|
|
|
|
|
private int time = 10; // 倒计时
|
|
|
|
|
private int flag = 0; // 标记
|
|
|
|
|
private bool fired = false; // 是否点火成功
|
|
|
|
|
private float pretime = 3f; // 准备时间
|
|
|
|
|
private float timestamp = 0f; // 冷却时间
|
|
|
|
|
private float wait = 1f; // 等待时间
|
|
|
|
|
private int time = 10; // 倒计时
|
|
|
|
|
private int flag = 0; // 标记
|
|
|
|
|
private bool passed = false;
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
@ -34,15 +34,15 @@ public class Game01 : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
if (pretime > 0)
|
|
|
|
|
{
|
|
|
|
|
// 游戏正式开始前的准备时间
|
|
|
|
|
// 游戏正式开始前的准备时间
|
|
|
|
|
left.GetComponentInChildren<Text>().text = pretime.ToString("f0");
|
|
|
|
|
right.GetComponentInChildren<Text>().text = pretime.ToString("f0");
|
|
|
|
|
pretime -= Time.deltaTime;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
GameLogic(); // 开始游戏主体逻辑
|
|
|
|
|
GameLogic(); // 开始游戏主体逻辑
|
|
|
|
|
}
|
|
|
|
|
// 火箭升空
|
|
|
|
|
// 火箭升空
|
|
|
|
|
if (fired)
|
|
|
|
|
{
|
|
|
|
|
rocket.transform.Translate(rocket.transform.up * 0.1f);
|
|
|
|
@ -112,7 +112,7 @@ public class Game01 : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
void Success() {
|
|
|
|
|
panel.SetActive(true);
|
|
|
|
|
panel.transform.GetComponentInChildren<Text>().text = "发射成功";
|
|
|
|
|
panel.transform.GetComponentInChildren<Text>().text = "发射成功";
|
|
|
|
|
foreach (GameObject f in fires)
|
|
|
|
|
{
|
|
|
|
|
f.SetActive(true);
|
|
|
|
@ -122,7 +122,7 @@ public class Game01 : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
void Failed() {
|
|
|
|
|
panel.SetActive(true);
|
|
|
|
|
panel.GetComponentInChildren<Text>().text = "发射失败";
|
|
|
|
|
panel.GetComponentInChildren<Text>().text = "发射失败";
|
|
|
|
|
Instantiate(fog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|