using BigSpace.XRCore.RunningScene; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShowCollectFontCtr : MonoBehaviour { public GameObject fontObj; public List position = new List(); List rotation = new List { 90,180,180,270,0,0}; //计时相关 bool isRun = false; float waitTime = 1f; float runTime = 0; // Start is called before the first frame update void Start() { ////关于等待出收集文字的 Debug.Log("当前场景编号:" + SceneMgr.Instance.nowSceneId); if (SceneMgr.Instance.nowSceneId % 10000 <= 1) { fontObj.SetActive(false); } else { isRun = true; } } private void Update() { if (isRun) { runTime += Time.deltaTime; if (runTime >= waitTime) { isRun = false; runTime = 0; SetPosition(); } } } void SetPosition() { int index = (SceneMgr.Instance.nowSceneId % 10000) - 2; //开始第0,1个场景不需要显示(跳转到下一个场景才需要显示) fontObj.SetActive(true); for (int i = 0; i < position.Count; i++) { if (index == i) { fontObj.transform.position = position[i]; fontObj.transform.localRotation = Quaternion.Euler(new Vector3(0, rotation[i], 0)); } } } }