ChangDaoZhanGuan/ChangDaoPro/Assets/Scripts/ModelMgr.cs

162 lines
3.5 KiB
C#

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<ModelMgr>();
DontDestroyOnLoad(obj);
}
return instance;
}
}
/// <summary>
/// 负一楼
/// </summary>
public GameObject b1f;
public GameObject a1f;
public GameObject a2f;
public GameObject a3f;
/// <summary>
/// 屋顶
/// </summary>
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;
}
}
/// <summary>
/// 负一楼
/// </summary>
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);
}
/// <summary>
/// 一楼
/// </summary>
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);
}
/// <summary>
/// 二楼
/// </summary>
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);
}
/// <summary>
/// 三楼
/// </summary>
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);
}
/// <summary>
/// 完整大楼
/// </summary>
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);
}
/// <summary>
/// 默认展示一楼
/// </summary>
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);
}
}