blob: 0759eb1481e1204702fd8ba212b8904c0de02b5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using UnityEngine;
// 批量控制某些go的显示和隐藏
public class HasControl : MonoBehaviour
{
public bool hasControl = true;
public GameObject[] objectsToRemove;//MainCamera ScreenShake
private void Awake()
{
UpdateControl();
}
private void UpdateControl()
{
GameObject[] array = objectsToRemove;
foreach (GameObject gameObject in array)
{
gameObject.SetActive(hasControl);
}
}
public void ChangeControl(bool control)
{
hasControl = control;
UpdateControl();
}
}
|