您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
782 B
36 行
782 B
using UnityEngine;
|
|
|
|
namespace GameplayIngredients.Actions
|
|
{
|
|
public class SwitcherAction : MonoBehaviour
|
|
{
|
|
public GameObject[] Objects;
|
|
public GameObject Default;
|
|
|
|
private void Start()
|
|
{
|
|
if (Default != null)
|
|
SwitchTo(Default);
|
|
}
|
|
|
|
public void SwitchTo(GameObject obj)
|
|
{
|
|
foreach (GameObject o in Objects)
|
|
{
|
|
if (o == null) continue;
|
|
if (o == obj)
|
|
{
|
|
if (!o.activeSelf)
|
|
o.SetActive(true);
|
|
|
|
}
|
|
else
|
|
{
|
|
if (o.activeSelf)
|
|
o.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|