IEnumerator DoorSoundEvent(float time, DoorEnter door)
    {
        yield return(new WaitForSeconds(time));

        Debug.Log("knock knock");

        door.GetComponent <DoorEnter>().knock.SetActive(true);
    }
    IEnumerator WaitBeforeEventOccur(float time, DoorEnter door)
    {
        yield return(new WaitForSeconds(time));

        GameObject enemy = (GameObject)Instantiate(Resources.Load("Prefabs/Enemy"), door.transform.position + new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0));

        enemy.GetComponent <EnemyScript>().spawnScreen = Application.loadedLevelName;
        enemy.GetComponent <EnemyScript>().ID          = "0A";
        door.GetComponent <DoorEnter>().isTriggerEvent = false;
        door.GetComponent <DoorEnter>().isLock         = false;
        door.GetComponent <DoorEnter>().knock.SetActive(false);

        Debug.Log("EventOccur!!!");
    }
    //summon enemy via door
    public void RandomSummonEvent()
    {
        GameObject[] allDoor = GameObject.FindGameObjectsWithTag("Door");

        for (int i = 0; i < allDoor.Length; i++)
        {
            if (allDoor[i].GetComponent <DoorEnter>().isTriggerEvent == true && allDoor[i].GetComponent <DoorEnter>().questlevelUnlock <= currentQuest.QuestID)
            {
                DoorEnter doorTemp = allDoor[i].GetComponent <DoorEnter>();
                StartCoroutine(DoorSoundEvent(2.0F, doorTemp));
                StartCoroutine(DoorSoundDisappear(3.0F, doorTemp));
                StartCoroutine(DoorSoundEvent(4.0F, doorTemp));
                StartCoroutine(WaitBeforeEventOccur(5.0F, doorTemp)); //enemy appear after 10 second
                break;
            }
        }
    }
    IEnumerator DoorSoundDisappear(float time, DoorEnter door)
    {
        yield return(new WaitForSeconds(time));

        door.GetComponent <DoorEnter>().knock.SetActive(false);
    }