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/Landmine.cs | |
parent | b45e22c164fa364263b00ce82842999f8e5976b2 (diff) |
*move
Diffstat (limited to 'Assembly_CSharp/Building/Landmine.cs')
-rw-r--r-- | Assembly_CSharp/Building/Landmine.cs | 67 |
1 files changed, 0 insertions, 67 deletions
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; - } -} |