32 lines
788 B
C#
32 lines
788 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.ToLower())
|
|
{
|
|
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.ToLower());
|
|
}
|
|
SceneManager.LoadScene(_scene);
|
|
}
|
|
}
|