diff options
author | chai <215380520@qq.com> | 2023-11-27 00:08:06 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-11-27 00:08:06 +0800 |
commit | d4af52c91a717d0ee324f81ad5a673d4a6ba9207 (patch) | |
tree | bdb610929b8cd3064632f12479cd47c16b752045 /Assembly_CSharp/Building | |
parent | b45e22c164fa364263b00ce82842999f8e5976b2 (diff) |
*move
Diffstat (limited to 'Assembly_CSharp/Building')
-rw-r--r-- | Assembly_CSharp/Building/Grave.cs | 3 | ||||
-rw-r--r-- | Assembly_CSharp/Building/HauntedHouse.cs | 111 | ||||
-rw-r--r-- | Assembly_CSharp/Building/House.cs | 49 | ||||
-rw-r--r-- | Assembly_CSharp/Building/IronVein.cs | 3 | ||||
-rw-r--r-- | Assembly_CSharp/Building/Landmine.cs | 67 | ||||
-rw-r--r-- | Assembly_CSharp/Building/ManaBank.cs | 68 | ||||
-rw-r--r-- | Assembly_CSharp/Building/ManaCrystal.cs | 3 | ||||
-rw-r--r-- | Assembly_CSharp/Building/ManaSiphon.cs | 92 | ||||
-rw-r--r-- | Assembly_CSharp/Building/Mine.cs | 81 | ||||
-rw-r--r-- | Assembly_CSharp/Building/Shrine.cs | 11 | ||||
-rw-r--r-- | Assembly_CSharp/Building/TreasureChest.cs | 26 | ||||
-rw-r--r-- | Assembly_CSharp/Building/University.cs | 150 |
12 files changed, 0 insertions, 664 deletions
diff --git a/Assembly_CSharp/Building/Grave.cs b/Assembly_CSharp/Building/Grave.cs deleted file mode 100644 index 45abddc..0000000 --- a/Assembly_CSharp/Building/Grave.cs +++ /dev/null @@ -1,3 +0,0 @@ -public class Grave : SpawnableObject -{ -} diff --git a/Assembly_CSharp/Building/HauntedHouse.cs b/Assembly_CSharp/Building/HauntedHouse.cs deleted file mode 100644 index 9a23eda..0000000 --- a/Assembly_CSharp/Building/HauntedHouse.cs +++ /dev/null @@ -1,111 +0,0 @@ -using UnityEngine; - -public class HauntedHouse : IncomeGenerator, IBuildable -{ - [SerializeField] - private LayerMask graveLayerMask; - - [SerializeField] - private GameObject UIObject; - - [SerializeField] - private int goldBackOnDemolish; - - private bool isGathering; - - private int graveCount; - - private int manaUsed; - - private float timer; - - private SimpleUI myUI; - - protected override void Start() - { - base.Start(); - DetectGraves(); - } - - private void Update() - { - if (myUI != null && isGathering) - { - string text = "Mana used: " + manaUsed; - text = text + "\nNearby graves: x" + graveCount; - text = text + "\nTax efficiency: x" + GameManager.instance.hauntedHouseEfficiency; - text = text + "\nDeath tax due: " + Mathf.Max((int)Mathf.Sqrt(manaUsed * GameManager.instance.hauntedHouseEfficiency * graveCount), 1) + "g"; - text = text + "\nNet tax collected: " + base.netGold + "g."; - myUI.SetDiscriptionText(text); - } - if (!isGathering || !SpawnManager.instance.combat) - { - return; - } - if (timer <= 0f) - { - if (ResourceManager.instance.CheckMana(1)) - { - ResourceManager.instance.SpendMana(1); - manaUsed++; - timer = 1f; - } - } - else - { - timer -= Time.deltaTime; - } - } - - public override void GenerateIncome() - { - incomePerRound = Mathf.Max((int)Mathf.Sqrt(manaUsed * GameManager.instance.hauntedHouseEfficiency * graveCount), 1); - base.GenerateIncome(); - manaUsed = 0; - incomePerRound = 1; - } - - public void SetStats() - { - } - - private void DetectGraves() - { - if (Physics.Raycast(base.transform.position + new Vector3(1f, 1f, 0f), -base.transform.up, out var hitInfo, 1f, graveLayerMask, QueryTriggerInteraction.Ignore)) - { - CheckGrave(hitInfo); - } - if (Physics.Raycast(base.transform.position + new Vector3(-1f, 1f, 0f), -base.transform.up, out hitInfo, 1f, graveLayerMask, QueryTriggerInteraction.Ignore)) - { - CheckGrave(hitInfo); - } - if (Physics.Raycast(base.transform.position + new Vector3(0f, 1f, 1f), -base.transform.up, out hitInfo, 1f, graveLayerMask, QueryTriggerInteraction.Ignore)) - { - CheckGrave(hitInfo); - } - if (Physics.Raycast(base.transform.position + new Vector3(0f, 1f, -1f), -base.transform.up, out hitInfo, 1f, graveLayerMask, QueryTriggerInteraction.Ignore)) - { - CheckGrave(hitInfo); - } - } - - private void CheckGrave(RaycastHit hit) - { - if (hit.collider.GetComponent<Grave>() != null && (double)Mathf.Abs(hit.collider.transform.position.y - base.transform.position.y) <= 0.001) - { - graveCount++; - isGathering = true; - } - } - - public void SpawnUI() - { - myUI = Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>(); - myUI.SetDemolishable(base.gameObject, goldBackOnDemolish); - } - - public void Demolish() - { - RemoveIncomeGeneration(); - } -} diff --git a/Assembly_CSharp/Building/House.cs b/Assembly_CSharp/Building/House.cs deleted file mode 100644 index 16bb26d..0000000 --- a/Assembly_CSharp/Building/House.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -public class House : SpawnableObject -{ - private List<Tower> defenders = new List<Tower>(); - - [SerializeField] - private IncomeGenerator myIncomeGenerator; - - protected override void Start() - { - base.Start(); - SpawnManager.instance.houses.Add(this); - } - - public void AddDefender(Tower t) - { - if (!defenders.Contains(t)) - { - defenders.Add(t); - } - CheckTowers(); - } - - public void CheckTowers() - { - for (int num = defenders.Count - 1; num > -1; num--) - { - if (defenders[num] == null) - { - defenders.RemoveAt(num); - } - } - myIncomeGenerator.incomeTimesLevel = defenders.Count; - } - - public override void SpawnUI() - { - SimpleUI component = Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>(); - if (defenders.Count > 0) - { - string text = "This house is protected by " + defenders.Count + " towers."; - text = text + "\nIts next gift will be " + (SpawnManager.instance.level + 1) * defenders.Count + "g."; - text = text + "\nNet gold gifted: " + myIncomeGenerator.netGold + "g."; - component.SetDiscriptionText(text); - } - } -} diff --git a/Assembly_CSharp/Building/IronVein.cs b/Assembly_CSharp/Building/IronVein.cs deleted file mode 100644 index 06af952..0000000 --- a/Assembly_CSharp/Building/IronVein.cs +++ /dev/null @@ -1,3 +0,0 @@ -public class IronVein : SpawnableObject -{ -} diff --git a/Assembly_CSharp/Building/Landmine.cs b/Assembly_CSharp/Building/Landmine.cs deleted file mode 100644 index 5422016..0000000 --- a/Assembly_CSharp/Building/Landmine.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections; -using UnityEngine; - -public class Landmine : Projectile -{ - public float blastRadius = 0.5f; - - private bool armed; - - [SerializeField] - private GameObject explosion; - - protected override void Start() - { - base.Start(); - SpawnManager.instance.destroyOnNewLevel.Add(base.gameObject); - } - - public void SetEndPosition(Vector3 endPos) - { - StartCoroutine(ThrowMine(endPos)); - } - - protected override void FixedUpdate() - { - } - - private void OnTriggerEnter(Collider other) - { - if (armed && other.gameObject.layer == LayerMask.NameToLayer("Enemy")) - { - Explode(); - } - } - - private void Explode() - { - Collider[] array = Physics.OverlapSphere(base.transform.position, blastRadius, layermask, QueryTriggerInteraction.Collide); - for (int i = 0; i < array.Length; i++) - { - IDamageable component = array[i].GetComponent<IDamageable>(); - if (component != null) - { - DealDamage(component); - } - } - Object.Instantiate(explosion, base.transform.position, Quaternion.identity).transform.localScale = Vector3.one * 0.5f; - SpawnManager.instance.destroyOnNewLevel.Remove(base.gameObject); - Object.Destroy(base.gameObject); - } - - private IEnumerator ThrowMine(Vector3 endPos) - { - Vector3 direction = endPos - base.transform.position; - float throwTime = 1f; - base.transform.localScale = Vector3.zero; - for (float i = 0f; i < 1f; i += Time.deltaTime / throwTime) - { - base.transform.localScale = Vector3.one * i; - base.transform.Translate(direction * Time.deltaTime / throwTime); - yield return null; - } - base.transform.localScale = Vector3.one; - base.transform.position = endPos; - armed = true; - } -} diff --git a/Assembly_CSharp/Building/ManaBank.cs b/Assembly_CSharp/Building/ManaBank.cs deleted file mode 100644 index b82d36e..0000000 --- a/Assembly_CSharp/Building/ManaBank.cs +++ /dev/null @@ -1,68 +0,0 @@ -using UnityEngine; - -public class ManaBank : MonoBehaviour, IBuildable -{ - [SerializeField] - private int gatherRatePerSec; - - [SerializeField] - private int maxManaIncrease; - - [SerializeField] - private GameObject UIObject; - - [SerializeField] - private int goldBackOnDemolish; - - private float timer = 1f; - - private void Start() - { - maxManaIncrease += ResourceManager.instance.manaBankBonusMana; - ResourceManager.instance.UpdateManaGatherRate(gatherRatePerSec); - ResourceManager.instance.AddMaxMana(maxManaIncrease); - ResourceManager.instance.manaBanks.Add(this); - } - - private void Update() - { - if (timer <= 0f) - { - Gather(); - timer = 1f; - } - else if (SpawnManager.instance.combat) - { - timer -= Time.deltaTime; - } - } - - public void SetStats() - { - } - - public void UpgradeMaxMana(int addition) - { - ResourceManager.instance.AddMaxMana(addition); - maxManaIncrease += addition; - } - - public void SpawnUI() - { - SimpleUI component = Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>(); - component.SetDemolishable(base.gameObject, goldBackOnDemolish); - component.SetDiscriptionText("This bank currently stores " + maxManaIncrease + " mana. It is generating " + ((float)Mathf.FloorToInt(10f * ResourceManager.instance.manaMaxRegenPercent * (float)maxManaIncrease) / 10f + 1f) + " mana/s through sorcery and clever investing."); - } - - public void Demolish() - { - ResourceManager.instance.UpdateManaGatherRate(-gatherRatePerSec); - ResourceManager.instance.AddMaxMana(-maxManaIncrease); - ResourceManager.instance.manaBanks.Remove(this); - } - - private void Gather() - { - ResourceManager.instance.AddMana(gatherRatePerSec); - } -} diff --git a/Assembly_CSharp/Building/ManaCrystal.cs b/Assembly_CSharp/Building/ManaCrystal.cs deleted file mode 100644 index 4b84e56..0000000 --- a/Assembly_CSharp/Building/ManaCrystal.cs +++ /dev/null @@ -1,3 +0,0 @@ -public class ManaCrystal : SpawnableObject -{ -} diff --git a/Assembly_CSharp/Building/ManaSiphon.cs b/Assembly_CSharp/Building/ManaSiphon.cs deleted file mode 100644 index 89e578e..0000000 --- a/Assembly_CSharp/Building/ManaSiphon.cs +++ /dev/null @@ -1,92 +0,0 @@ -using UnityEngine; - -public class ManaSiphon : MonoBehaviour, IBuildable -{ - [SerializeField] - private int gatherRatePerSec; - - [SerializeField] - private LayerMask layermask; - - [SerializeField] - private GameObject UIObject; - - [SerializeField] - private int goldBackOnDemolish; - - private bool gathering; - - private float timer = 1f; - - private void Start() - { - DetectMana(); - if (gathering) - { - ResourceManager.instance.UpdateManaGatherRate(gatherRatePerSec); - } - } - - private void Update() - { - if (timer <= 0f) - { - Gather(); - timer = 1f; - } - else if (gathering && SpawnManager.instance.combat) - { - timer -= Time.deltaTime; - } - } - - public void SetStats() - { - } - - public void SpawnUI() - { - SimpleUI component = Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>(); - component.SetDemolishable(base.gameObject, goldBackOnDemolish); - if (gathering) - { - component.SetDiscriptionText("Currently gathering 1 mana/sec."); - } - } - - public void Demolish() - { - if (gathering) - { - ResourceManager.instance.UpdateManaGatherRate(-gatherRatePerSec); - } - } - - private void Gather() - { - ResourceManager.instance.AddMana(gatherRatePerSec); - } - - private void DetectMana() - { - if ((!Physics.Raycast(base.transform.position + new Vector3(1f, 1f, 0f), -base.transform.up, out var hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(-1f, 1f, 0f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(0f, 1f, 1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && Physics.Raycast(base.transform.position + new Vector3(0f, 1f, -1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore)) - { - Rotate(hitInfo); - } - } - - private bool Rotate(RaycastHit hit) - { - if (hit.collider.GetComponent<ManaCrystal>() == null) - { - return false; - } - if ((double)Mathf.Abs(hit.collider.transform.position.y - base.transform.position.y) > 0.001) - { - return false; - } - base.transform.LookAt(hit.collider.transform.position, Vector3.up); - gathering = true; - return true; - } -} diff --git a/Assembly_CSharp/Building/Mine.cs b/Assembly_CSharp/Building/Mine.cs deleted file mode 100644 index 55d7b6f..0000000 --- a/Assembly_CSharp/Building/Mine.cs +++ /dev/null @@ -1,81 +0,0 @@ -using UnityEngine; - -public class Mine : MonoBehaviour, IBuildable -{ - [SerializeField] - private int goldBackOnDemolish; - - [SerializeField] - private LayerMask layermask; - - [SerializeField] - private GameObject UIObject; - - private bool gathering; - - private void Start() - { - SpawnManager.instance.mines.Add(this); - DetectIron(); - } - - public void SetStats() - { - } - - public void Repair() - { - if (gathering && Random.Range(0f, 1f) < 0.1f) - { - GameManager.instance.RepairTower(10); - } - } - - private void SetBonus(int value) - { - GameManager.instance.IncreaseTowerHealth(value); - } - - public void SpawnUI() - { - SimpleUI component = Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>(); - component.SetDemolishable(base.gameObject, goldBackOnDemolish); - if (gathering) - { - component.SetDiscriptionText("Currently mining. Tower maximum health increased by 1 and a 10% chance to repair damage."); - } - } - - private void DetectIron() - { - if ((!Physics.Raycast(base.transform.position + new Vector3(1f, 1f, 0f), -base.transform.up, out var hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(-1f, 1f, 0f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(0f, 1f, 1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && Physics.Raycast(base.transform.position + new Vector3(0f, 1f, -1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore)) - { - Rotate(hitInfo); - } - } - - private bool Rotate(RaycastHit hit) - { - if (hit.collider.GetComponent<IronVein>() == null) - { - return false; - } - if ((double)Mathf.Abs(hit.collider.transform.position.y - base.transform.position.y) > 0.001) - { - return false; - } - base.transform.LookAt(hit.collider.transform.position, Vector3.up); - gathering = true; - SetBonus(1); - return true; - } - - public void Demolish() - { - SpawnManager.instance.mines.Remove(this); - if (gathering) - { - SetBonus(-1); - } - } -} diff --git a/Assembly_CSharp/Building/Shrine.cs b/Assembly_CSharp/Building/Shrine.cs deleted file mode 100644 index bbdfd2d..0000000 --- a/Assembly_CSharp/Building/Shrine.cs +++ /dev/null @@ -1,11 +0,0 @@ -public class Shrine : SpawnableObject -{ - protected override void Start() - { - base.Start(); - if (spawned) - { - AchievementManager.instance.shrineSpawned = true; - } - } -} diff --git a/Assembly_CSharp/Building/TreasureChest.cs b/Assembly_CSharp/Building/TreasureChest.cs deleted file mode 100644 index cf18502..0000000 --- a/Assembly_CSharp/Building/TreasureChest.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; - -public class TreasureChest : MonoBehaviour, IBuildable -{ - [SerializeField] - private GameObject uiObject; - - public int numberOfDrops = 1; - - private void Start() - { - } - - public void SpawnUI() - { - Object.Instantiate(uiObject, base.transform.position, Quaternion.identity).GetComponent<TreasureUI>().myChest = base.gameObject; - } - - public void Demolish() - { - } - - public void SetStats() - { - } -} diff --git a/Assembly_CSharp/Building/University.cs b/Assembly_CSharp/Building/University.cs deleted file mode 100644 index 5115f50..0000000 --- a/Assembly_CSharp/Building/University.cs +++ /dev/null @@ -1,150 +0,0 @@ -using UnityEngine; - -public class University : MonoBehaviour, IBuildable -{ - [SerializeField] - private GameObject UIObject; - - [SerializeField] - private GameObject mainUIObject; - - public int goldBackOnDemolish; - - [SerializeField] - private LayerMask layermask; - - private bool active; - - public int healthPercent { get; private set; } - - public int armorPercent { get; private set; } - - public int shieldPercent { get; private set; } - - public int healthGained { get; private set; } - - public int armorGained { get; private set; } - - public int shieldGained { get; private set; } - - private void Start() - { - SpawnManager.instance.universities.Add(this); - DetectShrines(); - } - - public void SetStats() - { - } - - public void Research() - { - if (active) - { - if (Random.Range(0f, 100f) <= (float)(healthPercent + GameManager.instance.universityBonus)) - { - healthGained++; - TowerManager.instance.AddBonusHealthDamage(TowerType.Global, 1); - UniBonusUI.instance.UniBonus(1, 0, 0); - DamageNumber component = ObjectPool.instance.SpawnObject(ObjectPool.ObjectType.DamageNumber, base.transform.position, Quaternion.identity).GetComponent<DamageNumber>(); - component.SetText("New Discoveries!", "Grey", 1f); - component.SetHoldTime(2f); - AchievementManager.instance.NewDiscoveriesAchievement(); - } - if (Random.Range(0f, 100f) <= (float)(armorPercent + GameManager.instance.universityBonus)) - { - armorGained++; - UniBonusUI.instance.UniBonus(0, 1, 0); - TowerManager.instance.AddBonusArmorDamage(TowerType.Global, 1); - DamageNumber component2 = ObjectPool.instance.SpawnObject(ObjectPool.ObjectType.DamageNumber, base.transform.position, Quaternion.identity).GetComponent<DamageNumber>(); - component2.SetText("New Discoveries!", "Grey", 1f); - component2.SetHoldTime(2f); - AchievementManager.instance.NewDiscoveriesAchievement(); - } - if (Random.Range(0f, 100f) <= (float)(shieldPercent + GameManager.instance.universityBonus)) - { - shieldGained++; - UniBonusUI.instance.UniBonus(0, 0, 1); - TowerManager.instance.AddBonusShieldDamage(TowerType.Global, 1); - DamageNumber component3 = ObjectPool.instance.SpawnObject(ObjectPool.ObjectType.DamageNumber, base.transform.position, Quaternion.identity).GetComponent<DamageNumber>(); - component3.SetText("New Discoveries!", "Grey", 1f); - component3.SetHoldTime(2f); - AchievementManager.instance.NewDiscoveriesAchievement(); - } - } - } - - public void FundHealthStudies() - { - int num = (healthPercent + armorPercent + shieldPercent + 1) * 20; - if (ResourceManager.instance.CheckMoney(num)) - { - healthPercent++; - ResourceManager.instance.Spend(num); - AchievementManager.instance.FundResearchAchievement(num); - } - } - - public void FundArmorStudies() - { - int num = (healthPercent + armorPercent + shieldPercent + 1) * 20; - if (ResourceManager.instance.CheckMoney(num)) - { - armorPercent++; - ResourceManager.instance.Spend(num); - AchievementManager.instance.FundResearchAchievement(num); - } - } - - public void FundShieldStudies() - { - int num = (healthPercent + armorPercent + shieldPercent + 1) * 20; - if (ResourceManager.instance.CheckMoney(num)) - { - shieldPercent++; - ResourceManager.instance.Spend(num); - AchievementManager.instance.FundResearchAchievement(num); - } - } - - public void SpawnUI() - { - if (!active) - { - Object.Instantiate(UIObject, base.transform.position, Quaternion.identity).GetComponent<SimpleUI>().SetDemolishable(base.gameObject, goldBackOnDemolish); - } - else - { - Object.Instantiate(mainUIObject, base.transform.position, Quaternion.identity).GetComponent<UniversityUI>().SetStats(this); - } - } - - public void Demolish() - { - SpawnManager.instance.universities.Remove(this); - } - - private void DetectShrines() - { - if ((!Physics.Raycast(base.transform.position + new Vector3(1f, 1f, 0f), -base.transform.up, out var hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(-1f, 1f, 0f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && (!Physics.Raycast(base.transform.position + new Vector3(0f, 1f, 1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore) || !Rotate(hitInfo)) && Physics.Raycast(base.transform.position + new Vector3(0f, 1f, -1f), -base.transform.up, out hitInfo, 1f, layermask, QueryTriggerInteraction.Ignore)) - { - Rotate(hitInfo); - } - } - - private bool Rotate(RaycastHit hit) - { - if (hit.collider.GetComponent<Shrine>() == null) - { - return false; - } - if ((double)(hit.collider.transform.position.y - base.transform.position.y) > 0.001) - { - return false; - } - base.transform.LookAt(hit.collider.transform.position, Vector3.up); - active = true; - SetStats(); - return true; - } -} |