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()
|
|
|
|
{
|
2022-12-13 02:28:49 +01:00
|
|
|
gateway.currentMapName = SceneManager.GetActiveScene().name;
|
2022-05-15 16:40:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-12-10 02:24:32 +01:00
|
|
|
public static IEnumerator Wait()
|
|
|
|
{
|
|
|
|
yield return new WaitForSeconds(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-15 16:40:58 +02:00
|
|
|
public void ScenetToMoveTo()
|
|
|
|
{
|
2022-10-01 15:39:24 +02:00
|
|
|
//saving info about used gate/door/teleport
|
2022-12-06 01:20:01 +01:00
|
|
|
OnMapAppearanceMethod.SetTeleportedStatus();
|
2022-10-01 15:39:24 +02:00
|
|
|
|
|
|
|
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-12-04 18:42:34 +01:00
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerEquipmentItems();
|
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerQuests();
|
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerInventory();
|
2022-10-01 19:28:26 +02:00
|
|
|
SaveController.GetComponent<SaveController>().SaveHealth();
|
2022-11-24 03:48:23 +01:00
|
|
|
|
2022-12-06 01:20:01 +01:00
|
|
|
SaveController.GetComponent<SaveController>().SaveChests();
|
2022-12-19 03:34:45 +01:00
|
|
|
SaveController.GetComponent<SaveController>().SaveShops();
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|