예제 #1
0
    public void WaveStart()
    {
        Time.timeScale = GameManager.Instance.timeScale;
        if (0 == citadel.GetActiveUnitCount())
        {
            uiMessageBox.message = "마법사를 먼저 성에 배치 해주세요.";
            return;
        }

        Util.EventSystem.Publish(EventID.WaveStart, null);

        uiPlayPanel.gameObject.SetActive(true);
        gameState = GameState.Play;

        foreach (CitadelParts parts in citadel.citadelParts)
        {
            if (null != parts.slot.equippedUnit)
            {
                HeroUnit unit = parts.slot.equippedUnit;
                unit.SetActive(true);
            }
            if (null != parts.slot.touch)
            {
                parts.slot.SetActive(false);
            }
        }

        Wave wave = new Wave();

        waveCoroutine = wave.WaveStart();
        StartCoroutine(waveCoroutine);
    }
예제 #2
0
    public void WaveEnd(WaveResult result)
    {
        Time.timeScale = 1.0f;
        Util.EventSystem.Publish(EventID.WaveEnd, null);
        uiPlayPanel.gameObject.SetActive(false);
        gameState = GameState.Ready;
        if (WaveResult.Win == result)
        {
            waveLevel += 1;
        }
        else
        {
            enemyManager.Clear();
        }

        uiResultPanel.Active(result);

        if (null != waveCoroutine)
        {
            StopCoroutine(waveCoroutine);
        }

        foreach (CitadelParts parts in citadel.citadelParts)
        {
            if (null != parts.slot.equippedUnit)
            {
                HeroUnit unit = parts.slot.equippedUnit;
                unit.Init();
                unit.SetActive(false);
            }

            if (null != parts.slot.touch)
            {
                parts.slot.SetActive(true);
            }
        }

        uiWaveProgress.transform.Find("Text").GetComponent <Text> ().text = "WAVE " + waveLevel;
        uiWaveProgress.progress = 1.0f;

        while (0 < enemyManager.transform.childCount)
        {
            Transform child = enemyManager.transform.GetChild(0);
            child.SetParent(null);
            Object.Destroy(child.gameObject);
        }
        while (0 < creatures.childCount)
        {
            Transform child = creatures.GetChild(0);
            child.SetParent(null);
            Object.Destroy(child.gameObject);
        }
        citadel.Reset();
        Save();
    }