summaryrefslogtreecommitdiff
path: root/Assembly_CSharp/Building
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-11-26 23:52:30 +0800
committerchai <215380520@qq.com>2023-11-26 23:52:30 +0800
commit626381f061cde0c78564f6336e3131835cf20a5b (patch)
treed9991d6eda6ae5d7649ac91ecaa3b4dc833cd4c3 /Assembly_CSharp/Building
parent0e63c4a2c6dec8dfa260501fb7d73750261ea7b7 (diff)
* move
Diffstat (limited to 'Assembly_CSharp/Building')
-rw-r--r--Assembly_CSharp/Building/Grave.cs3
-rw-r--r--Assembly_CSharp/Building/HauntedHouse.cs111
-rw-r--r--Assembly_CSharp/Building/House.cs49
-rw-r--r--Assembly_CSharp/Building/IronVein.cs3
-rw-r--r--Assembly_CSharp/Building/Landmine.cs67
-rw-r--r--Assembly_CSharp/Building/ManaBank.cs68
-rw-r--r--Assembly_CSharp/Building/ManaCrystal.cs3
-rw-r--r--Assembly_CSharp/Building/ManaSiphon.cs92
-rw-r--r--Assembly_CSharp/Building/Mine.cs81
-rw-r--r--Assembly_CSharp/Building/Shrine.cs11
-rw-r--r--Assembly_CSharp/Building/TeslaCoil.cs45
-rw-r--r--Assembly_CSharp/Building/TreasureChest.cs26
-rw-r--r--Assembly_CSharp/Building/University.cs150
13 files changed, 709 insertions, 0 deletions
diff --git a/Assembly_CSharp/Building/Grave.cs b/Assembly_CSharp/Building/Grave.cs
new file mode 100644
index 0000000..45abddc
--- /dev/null
+++ b/Assembly_CSharp/Building/Grave.cs
@@ -0,0 +1,3 @@
+public class Grave : SpawnableObject
+{
+}
diff --git a/Assembly_CSharp/Building/HauntedHouse.cs b/Assembly_CSharp/Building/HauntedHouse.cs
new file mode 100644
index 0000000..9a23eda
--- /dev/null
+++ b/Assembly_CSharp/Building/HauntedHouse.cs
@@ -0,0 +1,111 @@
+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
new file mode 100644
index 0000000..16bb26d
--- /dev/null
+++ b/Assembly_CSharp/Building/House.cs
@@ -0,0 +1,49 @@
+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
new file mode 100644
index 0000000..06af952
--- /dev/null
+++ b/Assembly_CSharp/Building/IronVein.cs
@@ -0,0 +1,3 @@
+public class IronVein : SpawnableObject
+{
+}
diff --git a/Assembly_CSharp/Building/Landmine.cs b/Assembly_CSharp/Building/Landmine.cs
new file mode 100644
index 0000000..5422016
--- /dev/null
+++ b/Assembly_CSharp/Building/Landmine.cs
@@ -0,0 +1,67 @@
+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
new file mode 100644
index 0000000..b82d36e
--- /dev/null
+++ b/Assembly_CSharp/Building/ManaBank.cs
@@ -0,0 +1,68 @@
+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
new file mode 100644
index 0000000..4b84e56
--- /dev/null
+++ b/Assembly_CSharp/Building/ManaCrystal.cs
@@ -0,0 +1,3 @@
+public class ManaCrystal : SpawnableObject
+{
+}
diff --git a/Assembly_CSharp/Building/ManaSiphon.cs b/Assembly_CSharp/Building/ManaSiphon.cs
new file mode 100644
index 0000000..89e578e
--- /dev/null
+++ b/Assembly_CSharp/Building/ManaSiphon.cs
@@ -0,0 +1,92 @@
+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
new file mode 100644
index 0000000..55d7b6f
--- /dev/null
+++ b/Assembly_CSharp/Building/Mine.cs
@@ -0,0 +1,81 @@
+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
new file mode 100644
index 0000000..bbdfd2d
--- /dev/null
+++ b/Assembly_CSharp/Building/Shrine.cs
@@ -0,0 +1,11 @@
+public class Shrine : SpawnableObject
+{
+ protected override void Start()
+ {
+ base.Start();
+ if (spawned)
+ {
+ AchievementManager.instance.shrineSpawned = true;
+ }
+ }
+}
diff --git a/Assembly_CSharp/Building/TeslaCoil.cs b/Assembly_CSharp/Building/TeslaCoil.cs
new file mode 100644
index 0000000..97954e7
--- /dev/null
+++ b/Assembly_CSharp/Building/TeslaCoil.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections;
+using UnityEngine;
+
+public class TeslaCoil : Tower
+{
+ [SerializeField]
+ private GameObject lightningTrail;
+
+ protected override void AimTurret()
+ {
+ }
+
+ protected override void Fire()
+ {
+ if (consumesMana)
+ {
+ int manaCost = (int)((float)base.damage * manaConsumptionRate);
+ if (!ResourceManager.instance.CheckMana(manaCost))
+ {
+ return;
+ }
+ ResourceManager.instance.SpendMana(manaCost);
+ }
+ Vector3 position = base.transform.position;
+ position.y = 0f;
+ Collider[] array = Physics.OverlapSphere(position, base.range, enemyLayerMask, QueryTriggerInteraction.Collide);
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].GetComponent<IDamageable>()?.TakeDamage(towerType, base.damage, base.healthDamage, base.armorDamage, base.shieldDamage, base.slowPercent, base.bleedPercent, base.burnPercent, base.poisonPercent, base.critChance, base.stunChance);
+ }
+ SFXManager.instance.PlaySound(Sound.TeslaZap, base.transform.position);
+ StartCoroutine(DrawLightning());
+ }
+
+ private IEnumerator DrawLightning()
+ {
+ for (float i = 0f; i <= (float)Math.PI * 2f; i += 0.5f)
+ {
+ Vector3 vector = new Vector3(UnityEngine.Random.Range(-0.5f, 0.5f), UnityEngine.Random.Range(-0.5f, 0.5f), UnityEngine.Random.Range(-0.5f, 0.5f));
+ lightningTrail.transform.position = vector + new Vector3(base.transform.position.x + Mathf.Sin(i) * base.range, 0.75f, base.transform.position.z + Mathf.Cos(i) * base.range);
+ yield return new WaitForEndOfFrame();
+ }
+ }
+}
diff --git a/Assembly_CSharp/Building/TreasureChest.cs b/Assembly_CSharp/Building/TreasureChest.cs
new file mode 100644
index 0000000..cf18502
--- /dev/null
+++ b/Assembly_CSharp/Building/TreasureChest.cs
@@ -0,0 +1,26 @@
+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
new file mode 100644
index 0000000..5115f50
--- /dev/null
+++ b/Assembly_CSharp/Building/University.cs
@@ -0,0 +1,150 @@
+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;
+ }
+}