2022-05-15 16:40:58 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
public class DoorBehaviour : MonoBehaviour
|
|
|
|
{
|
|
|
|
public static DoorBehaviour Instance;
|
|
|
|
public string SceneName = "SampleScene";
|
|
|
|
|
2022-06-19 02:56:04 +02:00
|
|
|
public GameObject SaveController;
|
2022-05-15 16:40:58 +02:00
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
if(Instance == null)
|
|
|
|
{
|
|
|
|
Instance = this;
|
|
|
|
}else if (Instance != this)
|
|
|
|
{
|
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ScenetToMoveTo()
|
|
|
|
{
|
2022-06-19 02:56:04 +02:00
|
|
|
// 1. Save all befor change scene
|
|
|
|
SaveController.GetComponent<SaveController>().SaveItems();
|
|
|
|
SaveController.GetComponent<SaveController>().SaveQuests();
|
2022-06-19 14:38:22 +02:00
|
|
|
SaveController.GetComponent<SaveController>().SaveInventory();
|
2022-06-19 02:56:04 +02:00
|
|
|
// 2. Change scene
|
2022-05-15 16:40:58 +02:00
|
|
|
SceneManager.LoadScene(this.SceneName);
|
|
|
|
}
|
|
|
|
}
|