Code refactor, added coins chests, key chest and door

This commit is contained in:
2023-06-22 13:58:20 +03:00
parent 30a51d96f7
commit b2cf8fde92
18 changed files with 359 additions and 63 deletions
+25
View File
@@ -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();
}
}
}
}