ce358dafcb
Fix inventory slots bug
45 lines
1022 B
C#
45 lines
1022 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class DoorBehaviour : MonoBehaviour
|
|
{
|
|
public static DoorBehaviour Instance;
|
|
public string SceneName = "SampleScene";
|
|
|
|
public GameObject SaveController;
|
|
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()
|
|
{
|
|
// 1. Save all befor change scene
|
|
SaveController.GetComponent<SaveController>().SaveItems();
|
|
SaveController.GetComponent<SaveController>().SaveQuests();
|
|
SaveController.GetComponent<SaveController>().SaveInventory();
|
|
// 2. Change scene
|
|
SceneManager.LoadScene(this.SceneName);
|
|
}
|
|
}
|