diff options
| author | chai <215380520@qq.com> | 2024-05-19 16:05:01 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 16:05:01 +0800 |
| commit | c5f145786f4c6d2fe4bea831dfc16e52228920a5 (patch) | |
| tree | a6ead7ea8266c767d58ed0f816dcd7a1dd75bd65 /GameCode/BarricadeDamage.cs | |
| parent | 48b64e573a1709dc923cb9162b55be0246b3ff63 (diff) | |
* move
Diffstat (limited to 'GameCode/BarricadeDamage.cs')
| -rw-r--r-- | GameCode/BarricadeDamage.cs | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/GameCode/BarricadeDamage.cs b/GameCode/BarricadeDamage.cs deleted file mode 100644 index 09842f3..0000000 --- a/GameCode/BarricadeDamage.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -public class BarricadeDamage : MonoBehaviour -{ - public float preSelectRadius = 4f; - - public float slowTime = 3f; - - public List<DamageModifyer> damage; - - public LayerMask lmTakeDamage; - - private Collider[] overlapColliders = new Collider[50]; - - private float timeSinceLastCollisionCheck; - - private BoxCollider myCollider; - - private void Start() - { - myCollider = GetComponent<BoxCollider>(); - timeSinceLastCollisionCheck = Random.value; - } - - private void Update() - { - timeSinceLastCollisionCheck += Time.deltaTime; - if (timeSinceLastCollisionCheck < 0.2f) - { - return; - } - timeSinceLastCollisionCheck = 0f; - foreach (TaggedObject enemyUnit in TagManager.instance.EnemyUnits) - { - if (!(Vector3.Distance(base.transform.position, enemyUnit.transform.position) <= preSelectRadius) || enemyUnit.Hp.PathfindMovement.IsSlowed) - { - continue; - } - overlapColliders = Physics.OverlapBox(base.transform.position, myCollider.size, base.transform.rotation, lmTakeDamage); - Collider[] array = overlapColliders; - for (int i = 0; i < array.Length; i++) - { - TaggedObject componentInParent = array[i].GetComponentInParent<TaggedObject>(); - if (!componentInParent || !componentInParent.Tags.Contains(TagManager.ETag.EnemyOwned)) - { - continue; - } - Hp hp = componentInParent.Hp; - if ((bool)hp) - { - PathfindMovement pathfindMovement = hp.PathfindMovement; - if ((bool)pathfindMovement && !pathfindMovement.IsSlowed) - { - pathfindMovement.Slow(slowTime); - hp.TakeDamage(DamageModifyer.CalculateDamageOnTarget(componentInParent, damage)); - } - } - } - break; - } - } -} |
