using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class OnBoard : MonoBehaviour { //public GameObject objCount; public Text txtCount; public Text txtMsg; public int Counts=14; int seconds = 0; double startTime,curTime; int iOnBoard = 0; // Use this for initialization void Start () { seconds = 0; startTime = Time.time; } // Update is called once per frame void Update () { int i; seconds = (int)(Time.time-startTime); //txtCount.text = seconds.ToString(); i = Counts - seconds; if(i>=0) txtCount.text = i.ToString(); else { if (iOnBoard > 0) txtMsg.text = "成功登機"; else txtMsg.text = "登機失敗"; } } void OnTriggerEnter(Collider other) { Debug.Log(other.tag); //utxt1.text = other.tag.ToString(); if (other.tag == "Player") { iOnBoard = 1; //Debug.Log(other.tag); //SceneManager.LoadScene(1); } } }