add spawn point, death

This commit is contained in:
2023-07-10 19:21:58 +03:00
parent 9d68af5244
commit 2df859debe
9 changed files with 163 additions and 7 deletions
@@ -0,0 +1,25 @@
using Assets.Scripts;
using UnityEngine;
public class DoorInteract : MonoBehaviour
{
[SerializeField] private GameObject _doorGameObject;
private IDoor _door;
private void Awake()
{
_door =_doorGameObject.GetComponent<IDoor>();
}
private void OnTriggerEnter2D(Collider2D collider)
{
var player = collider.GetComponent<Player>();
if (player!=null)
{
if (player.IsHasKey())
{
_door.OpenDoor();
}
}
}
}