// Player가 Monster출연범위 안에 들어오면 실행된다. PlayerManager에서 호출한다. // Monster들을 List에 넣고 Attack를 시작하게한다. public void Ready_Attack(GameObject Monster_Group) { Monsters.Clear(); Monster_Group.GetComponent <BoxCollider>().enabled = false; //Monster_Group의 자식 == 출연할 몬스터 for (int i = 0; i < Monster_Group.transform.childCount; i++) { GameObject Monster = Monster_Group.transform.GetChild(i).gameObject; // 만약 자식오브젝트가 Monster가 아니라면 continue한다. if (Monster.CompareTag("Monster") == false) { continue; } MonsterAction monster_action = Monster.GetComponent <MonsterAction>(); PlayerManager.Get_Inctance().Set_ReTarget(monster_action); Monster.SetActive(true); Monsters.Add(Monster); //Monster들이 Attack을 시작하도록 함수를 호출한다. monster_action.StartSet_Attack(); } }
// Monster의 Target이 null이거나 active가 false면 PlayerManager에서 ReTarget함수를 실행시킨다. public void Check_Target() { for (int i = 0; i < Monsters.Count; i++) { if (Monsters[i] == null) { continue; } MonsterAction Monster = Monsters[i].GetComponent <MonsterAction>(); if (Monster.Check_StateProvocation()) { PlayerManager.Get_Inctance().Set_ReTarget(Monster); Monster.StartSet_Attack(); return; } else { if (Monster.Target == null || Monster.Target.gameObject.activeSelf == false) { PlayerManager.Get_Inctance().Set_ReTarget(Monster); return; } } } }