72 lines
1.2 KiB
C#
72 lines
1.2 KiB
C#
using System;
|
|
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class HideShowObjectTools : MonoBehaviour
|
|
{
|
|
[Serializable]
|
|
public struct stPartVisible
|
|
{
|
|
public bool isVisible;
|
|
|
|
public GameObject gameObject;
|
|
}
|
|
|
|
public bool objectVisible = true;
|
|
|
|
public GameObject[] hidenObjects;
|
|
|
|
public stPartVisible[] hidenObjects2;
|
|
|
|
private bool objectVisibleOld = true;
|
|
|
|
private void Start()
|
|
{
|
|
GameObject[] array = hidenObjects;
|
|
foreach (GameObject gameObject in array)
|
|
{
|
|
gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void OnDrawGizmos()
|
|
{
|
|
}
|
|
|
|
private void ChangeVisibleState()
|
|
{
|
|
stPartVisible[] array = hidenObjects2;
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
stPartVisible stPartVisible2 = array[i];
|
|
if ((bool)stPartVisible2.gameObject)
|
|
{
|
|
stPartVisible2.gameObject.SetActive(stPartVisible2.isVisible);
|
|
Debug.Log("Object status " + stPartVisible2.gameObject.name + " visible " + stPartVisible2.isVisible);
|
|
}
|
|
}
|
|
if (objectVisible == objectVisibleOld)
|
|
{
|
|
return;
|
|
}
|
|
GameObject[] array2 = hidenObjects;
|
|
foreach (GameObject gameObject in array2)
|
|
{
|
|
if ((bool)gameObject)
|
|
{
|
|
gameObject.SetActive(objectVisible);
|
|
}
|
|
}
|
|
objectVisibleOld = objectVisible;
|
|
}
|
|
|
|
[Button]
|
|
public void Test()
|
|
{
|
|
}
|
|
}
|