using System; using System.Collections; using System.Collections.Generic; using Invector; using UnityEngine; namespace Beyond { public class DeathCollider : MonoBehaviour { //vIHealthController public bool m_destroyOtherObjects = true; void Awake() { var collider = GetComponent(); if (!collider) { Debug.LogError("DeathCollider: no collider found!"); return; } collider.isTrigger = true; gameObject.layer = LayerMask.NameToLayer("Triggers"); } private void OnTriggerEnter(Collider other) { var health = other.GetComponent(); if (health != null) { health.TakeDamage(new vDamage(10000000, true)); Debug.Log($"GameObject: {health.gameObject.name} was killed by DeathCollider {gameObject.name}"); } else if (m_destroyOtherObjects) { Destroy(other.gameObject); } } } }