Old/Unity
RPG Project - Event
onenewkong
2023. 9. 16. 17:40
퀘스트를 구현하던 팀원이 넘겨줘서 몬스터 Die마다 monsterID를 넘겨주는 코드를 짜달라고 했는데, 내가 이벤트 핸들러를 구현해서 새로운 이벤트를 만들고 Invoke해야 하는 줄 알고.. 잘못 해갔다가 회의하면서 노션에 정리해둔 내용 보여줬는데 팀원이 당황했다...ㅎㅎ
그냥 구현되어 있는 Action에 매개변수만 넘기면 되는거였어서... 정말.. 바보였다...
다음부턴 커뮤니케이션을 잘 하기로 했고 덕분에 소통의 중요성을 깨달았다..
int MonsterID(object sender, EventArgs e)
{
if (this.CompareTag("Ork"))
{
monsterID = 2000;
}
else if (this.CompareTag("Golem"))
{
monsterID = 2005;
}
else if (this.CompareTag("Dragon"))
{
monsterID = 2010;
}
return monsterID;
}
if (_isDeath)
{
ChangedAction(eActionState.DIE);
gameObject.SetActive(false);
_isDeath = false;
stat.Hp = 10;
Managers.Quest.QuestPerformAction.Invoke(MonsterID(this, EventArgs.Empty));
return;
}