35 lines
840 B
C#
35 lines
840 B
C#
using UnityEngine;
|
|
|
|
namespace Lovatto.SceneLoader
|
|
{
|
|
|
|
public class bl_TriggerLoad : MonoBehaviour
|
|
{
|
|
|
|
public bool byName = true;
|
|
public string sceneName;
|
|
public int sceneID = 0;
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Player")
|
|
{
|
|
LoadScene();
|
|
}
|
|
}
|
|
|
|
public void LoadScene()
|
|
{
|
|
if (byName)
|
|
{
|
|
if (string.IsNullOrEmpty(sceneName)) return;
|
|
bl_SceneLoaderUtils.GetLoader.LoadLevel(sceneName);
|
|
}
|
|
else
|
|
{
|
|
sceneName = bl_SceneLoaderManager.Instance.List[sceneID].SceneName;
|
|
bl_SceneLoaderUtils.GetLoader.LoadLevel(sceneName);
|
|
}
|
|
}
|
|
}
|
|
} |