2022-05-15 16:40:58 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
public class DoorBehaviour : MonoBehaviour
|
|
|
|
{
|
2022-06-19 02:56:04 +02:00
|
|
|
public GameObject SaveController;
|
2022-10-01 15:39:24 +02:00
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
public Gateway gateway;
|
|
|
|
|
2022-05-15 16:40:58 +02:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ScenetToMoveTo()
|
|
|
|
{
|
2022-10-01 15:39:24 +02:00
|
|
|
//saving info about used gate/door/teleport
|
|
|
|
OnMapAppearanceMethod.Gateway = OnMapAppearanceMethodEnum.Gateway;
|
|
|
|
|
|
|
|
PlayerPrefs.SetString("gateway.sourceMapName", gateway.currentMapName);
|
|
|
|
PlayerPrefs.SetString("gateway.nextMapName", gateway.nextMapName);
|
|
|
|
|
|
|
|
PlayerPrefs.SetFloat("gateway.respawnCoords.x", gateway.respawnCoords.x);
|
|
|
|
PlayerPrefs.SetFloat("gateway.respawnCoords.y", gateway.respawnCoords.y);
|
|
|
|
PlayerPrefs.SetFloat("gateway.respawnCoords.z", gateway.respawnCoords.z);
|
|
|
|
|
|
|
|
// 1. Save all before change scene
|
2022-06-19 02:56:04 +02:00
|
|
|
SaveController.GetComponent<SaveController>().SaveItems();
|
|
|
|
SaveController.GetComponent<SaveController>().SaveQuests();
|
2022-06-19 14:38:22 +02:00
|
|
|
SaveController.GetComponent<SaveController>().SaveInventory();
|
2022-10-01 19:28:26 +02:00
|
|
|
SaveController.GetComponent<SaveController>().SaveHealth();
|
2022-06-19 02:56:04 +02:00
|
|
|
// 2. Change scene
|
2022-10-01 19:28:26 +02:00
|
|
|
SceneManager.LoadScene(gateway.nextMapName);
|
2022-05-15 16:40:58 +02:00
|
|
|
}
|
|
|
|
}
|