You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
930 B
31 lines
930 B
3 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
//Author:YHD
|
||
|
[RequireComponent(typeof(Button))]
|
||
|
public class HideSideBuilding : MonoBehaviour {
|
||
|
[HideInInspector]
|
||
|
public List<GameObject> hideObjs = new List<GameObject>();
|
||
|
private bool Flag = true;
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
GetComponent<Button>().onClick.AddListener(BtnClick);
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))
|
||
|
{
|
||
|
hideObjs.Add(TransformHelper.FindChild(GameObject.Find("SceneAll").transform, "Peilou").gameObject);//
|
||
|
hideObjs.Add(TransformHelper.FindChild(GameObject.Find("SceneAll").transform, "Object126").gameObject);//Object126
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void BtnClick()
|
||
|
{
|
||
|
Flag = !Flag;
|
||
|
foreach(var child in hideObjs)
|
||
|
{
|
||
|
child.SetActive(Flag);
|
||
|
}
|
||
|
}
|
||
|
}
|