28 lines
701 B
C#
28 lines
701 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Scampz.GameJam
|
|
{
|
|
public class LoadScene : MonoBehaviour
|
|
{
|
|
private bool loaded = false;
|
|
public Transform spawnPoint;
|
|
public int sceneIndex;
|
|
|
|
void OnTriggerEnter(Collider collider)
|
|
{
|
|
if (!loaded)
|
|
{
|
|
loaded = true;
|
|
var player = GameObject.FindWithTag("Player");
|
|
var cc = player.GetComponent<CharacterController>();
|
|
cc.enabled = false;
|
|
GameManager.Instance.LoadScene(sceneIndex, LoadSceneMode.Additive);
|
|
player.transform.position = spawnPoint.position;
|
|
player.transform.rotation = spawnPoint.rotation;
|
|
cc.enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|