MAJOR: Re-organize entire project
This commit is contained in:
29
Assets/Scripts/Scenes/LoadScene.cs
Normal file
29
Assets/Scripts/Scenes/LoadScene.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class LoadScene : MonoBehaviour
|
||||
{
|
||||
private bool loaded = false;
|
||||
public Transform spawnPoint;
|
||||
[SerializeField]
|
||||
private string scene;
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (!loaded)
|
||||
{
|
||||
loaded = true;
|
||||
var player = GameObject.FindWithTag("Player");
|
||||
var cc = player.GetComponent<CharacterController>();
|
||||
cc.enabled = false;
|
||||
GameManager.Instance.LoadScene(scene, LoadSceneMode.Additive);
|
||||
player.transform.position = spawnPoint.position;
|
||||
player.transform.rotation = spawnPoint.rotation;
|
||||
cc.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user