示例#1
0
文件: King.cs 项目: laiqiqi/Unity-8
    protected override void Awake()
    {
        mUnitType = UnitType.King;
        base.Awake();
        this.InitializeStats();

        mMeleeWeapon   = new Sword(mLevel);
        mCurrentWeapon = mMeleeWeapon;

        HealthBar.MaxValue = mMaxHealth;
        HealthBar.UpdateValue(mMaxHealth);
        GameState.KingsHealth = mMaxHealth;
    }
示例#2
0
 private void UpdateCooldownBar(Progressbar cooldownBar, AbilityTower tower)
 {
     if (tower != null)
     {
         cooldownBar.MaxValue = (int)(tower.ability.CoolDown * 100);
         cooldownBar.UpdateValue((int)(tower.ability.CooldownTimer * 100));
     }
 }
示例#3
0
    void Update()
    {
        foreach (UnitType u in mExpBars.Keys)
        {
            mExpBars [u].MaxValue = UnitStats.GetExpToNextLevel(u);
            mExpBars [u].UpdateValue((int)UnitStats.GetStat(u, UnitStat.Experience));
            mLevelText [u].text = ((int)UnitStats.GetStat(u, UnitStat.Level)).ToString();
        }

        // There is no special unit in the prehistoric era
        if (GameState.GameEra == Era.Prehistoric)
        {
            mLevelText [UnitType.Mage].text = "";
        }

        UpdateCooldownBar(HealCooldownBar, HealTower);
        UpdateCooldownTimer(mCooldownText[BonusSubject.HealTower], HealTower);

        UpdateCooldownBar(AoeCooldownBar, AoeTower);
        UpdateCooldownTimer(mCooldownText[BonusSubject.AOETower], AoeTower);

        UpdateCooldownBar(BoostCooldownBar, BoostTower);
        UpdateCooldownTimer(mCooldownText[BonusSubject.BuffTower], BoostTower);

        KingsHealthBar.UpdateValue(GameState.KingsHealth);
        GoldCounterText.text = GameState.Gold.ToString();
        WaveCounter.text     = GameState.RemainingWaves.ToString();

        if (GameState.IsDebug && Input.GetKeyDown("a"))
        {
            Time.timeScale += 0.5f;
        }

        if (GameState.IsDebug && Input.GetKeyDown("s"))
        {
            Time.timeScale -= 0.5f;
        }

        if (GameState.IsDebug && Input.GetKeyDown("b"))
        {
            UnitStats.SaveLevels();
        }

        if (GameState.IsDebug && Input.GetKeyDown("x"))
        {
            UnitStats.ResetLevels();
        }
    }
 private void UpdateCooldownBar(Progressbar cooldownBar, AbilityTower tower)
 {
     if (tower != null) {
         cooldownBar.MaxValue = (int)(tower.ability.CoolDown * 100);
         cooldownBar.UpdateValue((int)(tower.ability.CooldownTimer * 100));
     }
 }