diff options
author | chai <215380520@qq.com> | 2023-11-26 23:52:30 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-11-26 23:52:30 +0800 |
commit | 626381f061cde0c78564f6336e3131835cf20a5b (patch) | |
tree | d9991d6eda6ae5d7649ac91ecaa3b4dc833cd4c3 /Assembly_CSharp/GamePlay/IncomeGenerator.cs | |
parent | 0e63c4a2c6dec8dfa260501fb7d73750261ea7b7 (diff) |
* move
Diffstat (limited to 'Assembly_CSharp/GamePlay/IncomeGenerator.cs')
-rw-r--r-- | Assembly_CSharp/GamePlay/IncomeGenerator.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Assembly_CSharp/GamePlay/IncomeGenerator.cs b/Assembly_CSharp/GamePlay/IncomeGenerator.cs new file mode 100644 index 0000000..9afd8f5 --- /dev/null +++ b/Assembly_CSharp/GamePlay/IncomeGenerator.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +public class IncomeGenerator : MonoBehaviour +{ + public int incomePerRound; + + public float incomeTimesLevel; + + [SerializeField] + private DamageTracker.IncomeType myIncomeType; + + public int netGold { get; private set; } + + protected virtual void Start() + { + SpawnManager.instance.incomeGenerators.Add(this); + netGold = 0; + } + + public virtual void GenerateIncome() + { + int num = incomePerRound + (int)(incomeTimesLevel * (float)SpawnManager.instance.level); + if (num > 0) + { + ResourceManager.instance.AddMoney(num); + netGold += num; + DamageTracker.instance.AddIncome(myIncomeType, num); + SFXManager.instance.PlaySound(Sound.CoinShort, base.transform.position); + DamageNumber component = ObjectPool.instance.SpawnObject(ObjectPool.ObjectType.DamageNumber, base.transform.position, Quaternion.identity).GetComponent<DamageNumber>(); + component.SetText("+" + num + "g", "Grey", 1f); + component.SetHoldTime(2.5f); + } + } + + public void RemoveIncomeGeneration() + { + SpawnManager.instance.incomeGenerators.Remove(this); + } +} |