using System.Collections; using System.Collections.Generic; using UnityEngine; public class LiveSceneManager : SingletonMono { [HideInInspector] public FirstPersonController firstPersonController; [HideInInspector] public GameObject currentTool; public Transform spawnToolPos; public Transform tMDTips; public string triggerName; protected override void Awake() { base.Awake(); firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent(); tMDTips.gameObject.SetActive(false); } public void SetSpawnToolInfo(GameObject tool) { currentTool = tool; currentTool.transform.parent = Camera.main.transform; currentTool.transform.localPosition = spawnToolPos.localPosition; currentTool.transform.localEulerAngles = spawnToolPos.localEulerAngles; if (currentTool.GetComponent()) currentTool.GetComponent().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles); if (currentTool.GetComponent()) currentTool.GetComponent().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles); tMDTips.gameObject.SetActive(true); if (currentTool.name.Equals("工作证")) { GameManager.UIMgr.ShowPanel(E_UI_Layer.Mid, (p) => { p.Init(currentTool.name, "您好,我是xx供电公司员工,这是我的工作证。现在我们要对贵户更换电能计量表", (intTemp) => { GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(intTemp, true); ScoreManager.instance.Check(currentTool.name, null); if (currentTool != null) Destroy(currentTool); }); }); tMDTips.gameObject.SetActive(false); currentTool.transform.localEulerAngles = new Vector3(90, 0, 0); } if (currentTool.name.Equals("三相四线电能表")) { tMDTips.gameObject.SetActive(false); currentTool.transform.localEulerAngles = new Vector3(-90, 0, -180); } } private void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (currentTool != null) { if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true) == 0) { Debug.Log("Escape"); tMDTips.gameObject.SetActive(false); Destroy(currentTool); } } } } public void OnCheckSubProcess() { tMDTips.gameObject.SetActive(false); Destroy(currentTool); } }