IEnumerator GetDead()       // 사망 코루틴
    {
        state.isDead = true;
        uiCtrl.DestoryUI();
        ani.Down();

        for (int i = 0; i < explosionCount; i++)
        {
            // 랜덤한 방향으로 폭발 이펙트 생성
            Instantiate(explosion,
                        transform.position + new Vector3(Random.Range(-0.5f, 0.5f),
                                                         1.0f,
                                                         Random.Range(-0.5f, 0.5f)),
                        transform.rotation
                        );
            yield return(new WaitForSeconds(0.3f));
        }

        DownTime   -= explosionCount * explosionTerm;
        wsDeadTimer = new WaitForSeconds(DownTime);
        yield return(wsDeadTimer);

        Instantiate(explosionBig, transform.position, transform.rotation);
        Destroy(gameObject);
    }
예제 #2
0
 private void OnDestroy()
 {
     uiCtrl.DestoryUI();
 }