Global Game Jam 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
766 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Variables;
  5. public class MonsterHitbox : MonoBehaviour, IResettable
  6. {
  7. [SerializeField]
  8. Variable<bool> m_onPlayerDeath;
  9. public void OnLevelLoad()
  10. {
  11. }
  12. public void OnResetEnd()
  13. {
  14. gameObject.layer = LayerMask.NameToLayer("Default");
  15. }
  16. public IEnumerator OnResetStart(float time)
  17. {
  18. yield break;
  19. }
  20. private void OnTriggerEnter2D(Collider2D collision)
  21. {
  22. Debug.Log($"Collision with {collision.gameObject.name}");
  23. if (collision.CompareTag("Player"))
  24. {
  25. gameObject.layer = LayerMask.NameToLayer("Always Visible");
  26. m_onPlayerDeath.Value = true;
  27. }
  28. }
  29. }