lost me mind i did
This commit is contained in:
35
Assets/Scripts/SceneManagement/LevelChanger.cs
Normal file
35
Assets/Scripts/SceneManagement/LevelChanger.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class LevelChanger : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public int sceneIndex = 0;
|
||||
|
||||
public static LevelChanger Singleton { get; private set; }
|
||||
|
||||
public void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
//animator.SetTrigger("FadeOut");
|
||||
}
|
||||
|
||||
public void EnableControls()
|
||||
{
|
||||
//InputManager.Instance.enabled = true;
|
||||
}
|
||||
|
||||
public void DisableControls()
|
||||
{
|
||||
//InputManager.Instance.enabled = false;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Singleton is not null && Singleton != this)
|
||||
Destroy(this);
|
||||
else
|
||||
Singleton = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneManagement/LevelChanger.cs.meta
Normal file
11
Assets/Scripts/SceneManagement/LevelChanger.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b57ff8788cd779d4d8c417c92aa953e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Assets/Scripts/SceneManagement/LoadScene.cs
Normal file
23
Assets/Scripts/SceneManagement/LoadScene.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class LoadScene : MonoBehaviour
|
||||
{
|
||||
private bool loaded = false;
|
||||
[SerializeField]
|
||||
private string scene;
|
||||
[SerializeField]
|
||||
private Transform _spawnPoint;
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (!loaded && collider.CompareTag("Player"))
|
||||
{
|
||||
loaded = true;
|
||||
GameManager.Instance.LoadScene(scene, _spawnPoint, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneManagement/LoadScene.cs.meta
Normal file
11
Assets/Scripts/SceneManagement/LoadScene.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f7cf3b0e87656149a3acee1198cb0e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/Scripts/SceneManagement/SceneNames.cs
Normal file
7
Assets/Scripts/SceneManagement/SceneNames.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public static class SceneNames
|
||||
{
|
||||
public static string Singleton => "Singleton";
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneManagement/SceneNames.cs.meta
Normal file
11
Assets/Scripts/SceneManagement/SceneNames.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca1d98b6ac872ea419ad6eb89ca8db56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/SceneManagement/UnloadScene.cs
Normal file
20
Assets/Scripts/SceneManagement/UnloadScene.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class UnloadScene : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private string scene;
|
||||
private bool unloaded = false;
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (!unloaded)
|
||||
{
|
||||
unloaded = true;
|
||||
GameManager.Instance.UnloadScene(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneManagement/UnloadScene.cs.meta
Normal file
11
Assets/Scripts/SceneManagement/UnloadScene.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 492cbb8b94f132345bc45c0c471d3867
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user