Browse Source

forgot to push this

main
Joshua Reason 2 years ago
parent
commit
2a4058a9ae
2 changed files with 48 additions and 0 deletions
  1. +37
    -0
      Assets/Scripts/MonsterHitbox.cs
  2. +11
    -0
      Assets/Scripts/MonsterHitbox.cs.meta

+ 37
- 0
Assets/Scripts/MonsterHitbox.cs View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Variables;
public class MonsterHitbox : MonoBehaviour, IResettable
{
[SerializeField]
Variable<bool> 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;
}
}
}

+ 11
- 0
Assets/Scripts/MonsterHitbox.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 90b646f898d10024c8ba725c9a7892a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save