using System.Collections; using System.Collections.Generic; using UnityEngine; public class ModelMgr : MonoBehaviour { private static ModelMgr instance; public static ModelMgr Instance { get { if (instance == null) { GameObject obj = new GameObject("ModelMgr"); instance = obj.AddComponent(); DontDestroyOnLoad(obj); } return instance; } } /// /// 负一楼 /// public GameObject b1f; public GameObject a1f; public GameObject a2f; public GameObject a3f; /// /// 屋顶 /// public GameObject roof; private void Awake() { b1f = GameObject.Find("B1F按钮"); a1f = GameObject.Find("1F按钮"); a2f = GameObject.Find("2F按钮"); a3f = GameObject.Find("3F按钮"); roof = GameObject.Find("3F外壳按钮"); } public void PerformOperation(int operationType) { switch (operationType) { case 1: Operation1(); break; case 2: Operation2(); break; case 3: Operation3(); break; case 4: Operation4(); break; case 5: Operation5(); break; case 6: Operation6(); break; default: Debug.LogError("Invalid operation type"); break; } } /// /// 负一楼 /// private void Operation1() { Debug.Log("Performing Operation 1"); b1f.SetActive(true); a1f.SetActive(false); a2f.SetActive(false); a3f.SetActive(false); roof.SetActive(false); //SetCameraState(0); } /// /// 一楼 /// private void Operation2() { Debug.Log("Performing Operation 2"); b1f.SetActive(true); a1f.SetActive(true); a2f.SetActive(false); a3f.SetActive(false); roof.SetActive(false); //SetCameraState(0); } /// /// 二楼 /// private void Operation3() { Debug.Log("Performing Operation 3"); b1f.SetActive(true); a1f.SetActive(true); a2f.SetActive(true); a3f.SetActive(false); roof.SetActive(false); //SetCameraState(0); } /// /// 三楼 /// private void Operation4() { Debug.Log("Performing Operation 4"); b1f.SetActive(true); a1f.SetActive(true); a2f.SetActive(true); a3f.SetActive(true); roof.SetActive(false); //SetCameraState(0); } /// /// 完整大楼 /// private void Operation5() { Debug.Log("Performing Operation 5"); b1f.SetActive(true); a1f.SetActive(true); a2f.SetActive(true); a3f.SetActive(true); roof.SetActive(true); //SetCameraState(0); } /// /// 默认展示一楼 /// private void Operation6() { Debug.Log("Performing Operation 6"); b1f.SetActive(true); a1f.SetActive(true); a2f.SetActive(false); a3f.SetActive(false); roof.SetActive(false); //SetCameraState(0); } }