30 lines
712 B
C#
30 lines
712 B
C#
using UnityEngine;
|
|
|
|
public class Door : BaseInteractableObject
|
|
{
|
|
[SerializeField]
|
|
private string _scene;
|
|
[SerializeField]
|
|
private string _exitName;
|
|
|
|
private void Start()
|
|
{
|
|
if (PlayerPrefs.GetString("lastExitName") == _exitName.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.Instance.ChangeScene(_scene);
|
|
}
|
|
}
|
|
|