diff options
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; - } - } -} |
