Files
M-Gameton-06/Gameton-06/Assets/Gameton/Scripts/Monster/Attack.cs

33 lines
784 B
C#

using UnityEngine;
namespace TON
{
public class Attack : MonoBehaviour
{
[SerializeField]
private MonsterBase _monsterBase;
public void SetMonsterBase(MonsterBase monsterBase)
{
_monsterBase = monsterBase;
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
_monsterBase.IsAttacking = true;
}
}
private void OnTriggerExit2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
_monsterBase.IsAttacking = false;
_monsterBase.IsFinishAttack = true; // 공격 종료 상태로 설정
}
}
}
}