コード例 #1
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();
    }
コード例 #2
0
    public void Init()
    {
        HeroUnit unit = GameManager.Instance.selectedUnit;

        if (null == unit)
        {
            return;
        }
        unit.Init();
        textName.text    = unit.info.name;
        imageUnit.sprite = unit.info.icon;
        textLevel.text   = unit.level.ToString();

        textAttackPower.gameObject.SetActive(false);
        textAttackSpeed.gameObject.SetActive(false);
        textCritical.gameObject.SetActive(false);
        imageUnit.gameObject.SetActive(true);
        textAttackPower.gameObject.SetActive(true);
        textAttackSpeed.gameObject.SetActive(true);
        textCritical.gameObject.SetActive(true);
        textAttackPower.text = (Mathf.Round(unit.passiveAttack.data.power * 10.0f) * 0.1f).ToString();
        textAttackSpeed.text = (Mathf.Round(unit.passiveAttack.data.speed * 10.0f) * 0.1f).ToString();

        passiveSkill.Init(unit.passiveAttack);
        activeSkill.Init(unit.activeAttack);
        int upgradeGold = unit.info.upgradePrice * unit.level;

        buttonLevelup.transform.Find("Text").GetComponent <Text> ().text = "Upgrade\n<size=10>(" + upgradeGold.ToString() + " G)</size>";

        buttonBuy.gameObject.SetActive(false);
        buttonBuy.transform.Find("Text").GetComponent <Text> ().text = "Buy\n<size=10>(" + unit.info.purchasePrice.ToString() + " G)</size>";
        buttonEquip.gameObject.SetActive(false);
        buttonLevelup.gameObject.SetActive(false);

        if (true == unit.purchased)
        {
            buttonLevelup.gameObject.SetActive(true);
        }
        else
        {
            buttonBuy.gameObject.SetActive(true);
        }

        if (true == unit.purchased && (unit.slotIndex != GameManager.Instance.selectedSlot.slotIndex || false == unit.equiped))
        {
            buttonEquip.gameObject.SetActive(true);
        }
    }
コード例 #3
0
    void Start()
    {
        gold           = DEFAULT_GOLD;
        gameState      = GameState.Ready;
        selectedSlot   = null;
        selectedUnit   = null;
        timeScale      = 1.0f;
        Time.timeScale = timeScale;

        citadel.Init();

        Load();

        Util.EventSystem.Publish(EventID.GameStart, this);

        uiWaveProgress.transform.Find("Text").GetComponent <Text>().text = "WAVE " + waveLevel;
        foreach (var itr in citadel.heros)
        {
            HeroUnit hero = itr.Value;
            hero.Init();
        }
        citadel.Reset();
    }