26 lines
519 B
C#
26 lines
519 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class EnemyAttack : MonoBehaviour
|
|
{
|
|
|
|
public delegate void HitByEnemyDelegate(Collider2D coll) ;
|
|
public HitByEnemyDelegate HitByEnemy ;
|
|
|
|
void Start()
|
|
{
|
|
}
|
|
|
|
|
|
private void OnTriggerStay2D(Collider2D coll)
|
|
{
|
|
if (coll.gameObject.CompareTag("Player"))
|
|
{
|
|
HitByEnemy?.Invoke(coll);
|
|
}
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|