2022-12-10 02:24:32 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
public class AnimatedDoorBehaviour : TriggerDoor
|
|
|
|
{
|
|
|
|
public GameObject SaveController;
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
public Gateway gateway;
|
|
|
|
|
|
|
|
|
|
|
|
Animator animator;
|
|
|
|
|
2022-12-13 01:03:03 +01:00
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
DoorOpenAnimatorParamName = "DoorOpen";
|
|
|
|
}
|
|
|
|
|
2022-12-10 02:24:32 +01:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
animator = GetComponent<Animator>();
|
2022-12-13 02:28:49 +01:00
|
|
|
gateway.currentMapName = SceneManager.GetActiveScene().name;
|
2022-12-10 02:24:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private IEnumerator coroutine;
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerator Wait(float waitTime)
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
yield return new WaitForSeconds(waitTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ScenetToMoveTo()
|
|
|
|
{
|
|
|
|
//coroutine = Wait(2.0f);
|
|
|
|
//StartCoroutine(coroutine);
|
|
|
|
animator.SetBool(DoorOpenAnimatorParamName, true);
|
|
|
|
|
|
|
|
|
|
|
|
//saving info about used gate/door/teleport
|
|
|
|
OnMapAppearanceMethod.SetTeleportedStatus();
|
|
|
|
|
|
|
|
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
|
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerEquipmentItems();
|
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerQuests();
|
|
|
|
SaveController.GetComponent<SaveController>().SavePlayerInventory();
|
|
|
|
SaveController.GetComponent<SaveController>().SaveHealth();
|
|
|
|
|
|
|
|
SaveController.GetComponent<SaveController>().SaveChests();
|
2022-12-19 03:34:45 +01:00
|
|
|
SaveController.GetComponent<SaveController>().SaveShops();
|
2023-01-03 22:44:24 +01:00
|
|
|
SaveController.GetComponent<SaveController>().SaveDialogues();
|
|
|
|
SaveController.GetComponent<SaveController>().SaveMissions();
|
|
|
|
|
2022-12-10 02:24:32 +01:00
|
|
|
|
|
|
|
// 2. Change scene
|
|
|
|
SceneManager.LoadScene(gateway.nextMapName);
|
|
|
|
}
|
|
|
|
}
|