31 lines
794 B
C#
31 lines
794 B
C#
using UnityEngine;
|
|
|
|
public class Door : BaseInteractableObject
|
|
{
|
|
[SerializeField]
|
|
private string _scene;
|
|
[SerializeField]
|
|
private string _exitName;
|
|
|
|
protected override void PrepareMenuActions()
|
|
{
|
|
if (PlayerPrefs.GetString("lastExitName") == _exitName.ToLower())
|
|
{
|
|
print($"Player came from to {_scene}");
|
|
Player.Instance.SetPosition(_interactionPoint.position);
|
|
}
|
|
|
|
_menuActions[RadialMenuActions.Open].IsEnabled = true;
|
|
}
|
|
|
|
protected override void InteractAction(RadialMenuActions interactAction)
|
|
{
|
|
if (!string.IsNullOrEmpty(_exitName))
|
|
{
|
|
PlayerPrefs.SetString("lastExitName", _exitName.ToLower());
|
|
}
|
|
SceneManager.Instance.ChangeScene(_scene);
|
|
}
|
|
}
|
|
|