32 lines
768 B
C#
32 lines
768 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class Door : BaseInteractableObject
|
|
{
|
|
[SerializeField]
|
|
private string _scene;
|
|
[SerializeField]
|
|
private string _exitName;
|
|
[SerializeField]
|
|
private string _enterName;
|
|
|
|
private void Start()
|
|
{
|
|
if (PlayerPrefs.GetString("lastExitName") == _enterName)
|
|
{
|
|
print($"Player came from to {_scene}");
|
|
Player.Instance.SetPosition(_interactionPoint.position);
|
|
}
|
|
}
|
|
|
|
public override void Interact(Player player)
|
|
{
|
|
print($"Player go to {_scene}");
|
|
if (!string.IsNullOrEmpty(_exitName))
|
|
{
|
|
PlayerPrefs.SetString("lastExitName", _exitName);
|
|
}
|
|
SceneManager.LoadScene(_scene);
|
|
}
|
|
}
|