public void Reset() { foreach (CitadelPartsSpriteInfo info in citadelPartsSpriteInfo) { if (info.level <= level) { CitadelParts parts = citadelParts [info.partsIndex]; parts.gameObject.SetActive(true); parts.front.sprite = info.front; parts.back.sprite = info.back; } else { break; } } foreach (CitadelBuff buff in citadelBuffs) { buff.Init(); } health.max = healthUpgradeInfo.baseValue + (level - 1) * healthUpgradeInfo.upgradeValue; health.value = health.max; health.recovery = 1; health.interval = healthUpgradeInfo.recoverySpeed * Mathf.Max(1 + healthUpgradeInfo.recoveryBonus, 0.01f); mana.max = manaUpgradeInfo.baseValue + (level - 1) * manaUpgradeInfo.upgradeValue; mana.value = mana.max; mana.recovery = 1; mana.interval = manaUpgradeInfo.recoverySpeed * Mathf.Max(1 + manaUpgradeInfo.recoveryBonus, 0.01f); }
public void Init() { { Transform t = transform.Find("Heros"); for (int i = 0; i < t.childCount; i++) { HeroUnit hero = t.GetChild(i).GetComponent <HeroUnit> (); hero.gameObject.SetActive(false); heros [hero.info.id] = hero; } } { Transform t = transform.Find("Animation/Parts"); citadelParts = new CitadelParts[t.childCount]; for (int i = 0; i < t.childCount; i++) { CitadelParts parts = t.GetChild(i).GetComponent <CitadelParts> (); parts.Init(); parts.gameObject.SetActive(false); citadelParts [parts.slotIndex] = parts; } } boughtUnitCount = 1; }