Beispiel #1
0
    void Update()
    {
        //Round Transition
        if (LimitTime < 0)
        {
            ++timerCount;

            if (timerCount % 2 == 0)
            {
                light.transform.rotation = Quaternion.identity;
                light_speed = 0.14f;
                audio.Alarm();
                bgm.day();                                                                  //탐색 브금 켜기
                DayTimeUI.SetActive(true);                                                  //안내메시지 출력
                StartCoroutine(CallDayTimeUI(2));                                           //제거
                LimitTime = 30.0f;
                Create_Zombie.SetActive(false);
                zombie_count = 0;
            }
            else
            {
                light.transform.Rotate(Vector3.right, 45.0f);
                light_speed = 0.06f;
                audio.Alarm();
                bgm.night();                                                                //방어 브금 켜기
                NightTimeUI.SetActive(true);                                                //안내메시지 출력
                Time.timeScale   = 0.0f;
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;
                LimitTime        = 30.0f;
                Create_Zombie.SetActive(true);
            }
        }

        if ((serums != null) && (timerCount == 0))
        {
            serums.transform.position = new Vector3(serums.transform.position.x, 1.5f, serums.transform.position.z);
        }

        LimitTime      -= Time.deltaTime;
        text_Timer.text = "Time: " + Mathf.Round(LimitTime);
    }
    void Start()
    {
        player      = GameObject.FindGameObjectWithTag("Player");
        hp          = player.GetComponent <PlayerHealth>();
        playerLight = GameObject.FindGameObjectWithTag("PlayerLight");
        playerLight.SetActive(false);
        serumUI     = GameObject.FindGameObjectWithTag("SerumUI");
        serum_count = serumUI.GetComponent <SerumUI>();
        serums      = GameObject.FindGameObjectsWithTag("Serum");
        Create_Zombie.SetActive(false);
        soundController = GameObject.FindGameObjectWithTag("SoundController");
        audio           = soundController.GetComponent <SoundController>();
        bgmController   = GameObject.FindGameObjectWithTag("BGMController");
        bgm             = bgmController.GetComponent <BGMController>();

        audio.Alarm();
        bgm.day();                                              //BGM출력
        DayTimeUI.SetActive(true);                              //안내메시지 출력
        RoundText.text = "Round  " + RoundNum;                  //라운드 표시
        StartCoroutine(CallDayTimeUI(2));                       //안내메시지 제거
    }
    void Update()
    {
        //Round Transition
        if (LimitTime < 0)
        {
            ++timerCount;
            if (timerCount % 2 == 0)
            {
                playerLight.SetActive(false);
                light.transform.rotation = Quaternion.identity;
                light_speed = 0.06f;
                audio.Alarm();
                bgm.day();                                                                  //탐색 브금 켜기
                RoundText.text = "Round  " + RoundNum;                                      //라운드 표시
                DayTimeUI.SetActive(true);                                                  //안내메시지 출력
                StartCoroutine(CallDayTimeUI(2));                                           //제거
                LimitTime = 60.0f;
                Create_Zombie.SetActive(false);
                if (current_zombie != 0) //현재 남아있는 좀비
                {
                    hp.TakeDamage(hp.currentHealth);
                    Debug.Log("Dead because zombie is alive");
                }
                zombie_count      = 0;
                rush_zombie_count = 0;
            }
            else
            {
                playerLight.SetActive(true);
                light.transform.Rotate(Vector3.right, 45.0f);
                light_speed = 0.03f;
                audio.Alarm();
                bgm.night();                                                      //방어 브금 켜기
                NightTimeUI.SetActive(true);                                      //안내메시지 출력
                StartCoroutine(CallNightTimeUI(2));                               //제거
                RoundNum++;                                                       //라운드 Num 증가시킴
                LimitTime = 90.0f;
                if (timerCount == 5)
                {
                    boss.create();
                    current_zombie += 1;
                }
                if (timerCount == 7)
                {
                    Debug.Log("Dead because round 4 is over");
                    hp.TakeDamage(hp.currentHealth);
                }
                Create_Zombie.SetActive(true);
            }
        }

        if ((serum1 != null) && (timerCount == 0))
        {
            serum1.transform.position = new Vector3(serum1.transform.position.x, 3.5f, serum1.transform.position.z);
        }
        else if ((serum2 != null) && (timerCount == 2))
        {
            serum2.transform.position = new Vector3(serum2.transform.position.x, 3.5f, serum2.transform.position.z);
        }
        else if ((serum3 != null) && (timerCount == 4))
        {
            serum3.transform.position = new Vector3(serum3.transform.position.x, 3.5f, serum3.transform.position.z);
        }

        LimitTime      -= Time.deltaTime;
        text_Timer.text = "Time: " + Mathf.Round(LimitTime);
        ZombieNum.text  = "zombies :  " + current_zombie;
    }