diff --git a/Assets/Scripts/MonsterHitbox.cs b/Assets/Scripts/MonsterHitbox.cs new file mode 100644 index 0000000..b5879db --- /dev/null +++ b/Assets/Scripts/MonsterHitbox.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Variables; + +public class MonsterHitbox : MonoBehaviour, IResettable +{ + [SerializeField] + Variable m_onPlayerDeath; + + public void OnLevelLoad() + { + + } + + public void OnResetEnd() + { + gameObject.layer = LayerMask.NameToLayer("Default"); + } + + public IEnumerator OnResetStart(float time) + { + yield break; + } + + + private void OnTriggerEnter2D(Collider2D collision) + { + Debug.Log($"Collision with {collision.gameObject.name}"); + if (collision.CompareTag("Player")) + { + gameObject.layer = LayerMask.NameToLayer("Always Visible"); + m_onPlayerDeath.Value = true; + } + } + +} diff --git a/Assets/Scripts/MonsterHitbox.cs.meta b/Assets/Scripts/MonsterHitbox.cs.meta new file mode 100644 index 0000000..5748ffe --- /dev/null +++ b/Assets/Scripts/MonsterHitbox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90b646f898d10024c8ba725c9a7892a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: