您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
924 B
47 行
924 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AreaLoad : MonoBehaviour
|
|
{
|
|
public GameObject[] areaToHide;
|
|
public GameObject[] areaToShow;
|
|
public bool area1Hidden = false;
|
|
public bool area2Shown = false;
|
|
|
|
private void Awake()
|
|
{
|
|
for (int i = 0; i < areaToShow.Length; i++)
|
|
{
|
|
areaToShow[i].SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
for (int i = 0; i < areaToHide.Length; i++)
|
|
{
|
|
areaToHide[i].SetActive(false);
|
|
}
|
|
for (int i = 0; i < areaToShow.Length; i++)
|
|
{
|
|
areaToShow[i].SetActive(true);
|
|
}
|
|
area1Hidden = true;
|
|
area2Shown = true;
|
|
}
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
for (int i = 0; i < areaToHide.Length; i++)
|
|
{
|
|
areaToHide[i].SetActive(true);
|
|
}
|
|
for (int i = 0; i < areaToShow.Length; i++)
|
|
{
|
|
areaToShow[i].SetActive(false);
|
|
}
|
|
area1Hidden = false;
|
|
area2Shown = false;
|
|
}
|
|
|
|
}
|