보스의 공격 코드
IEnumerator DestroyRuneSkill()
{
yield return new WaitForSeconds(Constant.BOSS_SKILL_COOL_TIME);
for (int i = 0; i < Constant.BOSS_SKILL_COUNT; ++i)
{
Board.Inst.DestroyRune();
if (Board.Inst.RunePosition != Vector3.zero)
{
var bulletEffect = Instantiate(bossBullet, Board.Inst.RunePosition, Quaternion.identity);
Destroy(bulletEffect, 2f);
yield return new WaitForEndOfFrame();
}
else
{
yield break;
}
}
}
공격방식은 보드에서 각라인의 배열안에 룬이 있는지 확인을 하고 50퍼센트 확률로 룬을 파괴한다.
보드에 파괴 코드
public void DestroyRune()
{
for (int i = 0; i < lines.Length; i++)
{
if (lines[i].CurrentIndex > 0)
{
// 50 퍼 확률로 룬 파괴 (0 , 1)
int onDestroy = Random.Range(0 , 2);
if (onDestroy == 0)
{
Debug.Log(lines[i].name + "파괴");
lines[i].DestroyRune();
//해당 타일 위치에 룬 포지션
var RuneIndex = lines[i].DestroyIndex;
RunePosition = lines[i].tiles[RuneIndex].rune.transform.position;
break;
}
}
}
}