summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 16:46:27 +0800
committerchai <215380520@qq.com>2024-05-19 16:46:27 +0800
commit8b1fc7063b387542803c6bc214ccf8acb32870bd (patch)
treed310eb99872c8215f1c1f67731ec21f0915cd778 /Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs
parent8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (diff)
* rename
Diffstat (limited to 'Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs')
-rw-r--r--Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs104
1 files changed, 0 insertions, 104 deletions
diff --git a/Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs b/Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs
deleted file mode 100644
index 824352e..0000000
--- a/Thronefall_1_0/GameCode/Mill_ImprovementWindSpirits.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Mill_ImprovementWindSpirits : MonoBehaviour, DayNightCycle.IDaytimeSensitive
-{
- [SerializeField]
- private BuildSlot buildSlot;
-
- [SerializeField]
- private float blockIntervalLvl1 = 1f;
-
- [SerializeField]
- private float blockIntervalLvl2 = 0.5f;
-
- [SerializeField]
- private float blockIntervalLvl3 = 0.25f;
-
- public Mesh lvl2Mesh;
-
- public Mesh lvl3Mesh;
-
- private float blockInterval = 1f;
-
- [SerializeField]
- private float range = 30f;
-
- [SerializeField]
- private GameObject fxBlockArrow;
-
- private float cooldown;
-
- private TagManager tagManager;
-
- private List<TagManager.ETag> mustHaveTags = new List<TagManager.ETag>();
-
- private List<TagManager.ETag> mayNotHaveTags = new List<TagManager.ETag>();
-
- private void Start()
- {
- tagManager = TagManager.instance;
- cooldown = Random.value * blockInterval;
- mustHaveTags.Add(TagManager.ETag.BlockableEnemyProjectile);
- DayNightCycle.Instance.RegisterDaytimeSensitiveObject(this);
- }
-
- private void Update()
- {
- cooldown -= Time.deltaTime;
- while (cooldown <= 0f)
- {
- BlockAnArrow();
- cooldown += blockInterval;
- }
- }
-
- private void BlockAnArrow()
- {
- TaggedObject taggedObject = tagManager.FindClosestTaggedObjectWithTags(base.transform.position, mustHaveTags, mayNotHaveTags);
- if (!(taggedObject == null) && (taggedObject.transform.position - base.transform.position).magnitude < range)
- {
- if ((bool)fxBlockArrow)
- {
- Object.Instantiate(fxBlockArrow, taggedObject.transform.position, Quaternion.identity);
- }
- Object.Destroy(taggedObject.gameObject);
- }
- }
-
- private void OnEnable()
- {
- buildSlot.upgrades[1].upgradeBranches[0].replacementMesh = lvl2Mesh;
- buildSlot.upgrades[2].upgradeBranches[0].replacementMesh = lvl3Mesh;
- SetCorrectWeapon();
- }
-
- public void OnDusk()
- {
- SetCorrectWeapon();
- }
-
- public void OnDawn_AfterSunrise()
- {
- }
-
- public void OnDawn_BeforeSunrise()
- {
- }
-
- private void SetCorrectWeapon()
- {
- if (buildSlot.Level == 1)
- {
- blockInterval = blockIntervalLvl1;
- }
- else if (buildSlot.Level == 2)
- {
- blockInterval = blockIntervalLvl2;
- }
- else if (buildSlot.Level == 3)
- {
- blockInterval = blockIntervalLvl3;
- }
- }
-}