OvrObjAutoDestory.cs 373 B

123456789101112131415161718192021
  1. using System;
  2. using UnityEngine;
  3. public class OvrObjAutoDestory : MonoBehaviour
  4. {
  5. private void Update()
  6. {
  7. if (base.transform.position.y < this.m_fDestroyY)
  8. {
  9. if (this.m_goTarget == null)
  10. {
  11. this.m_goTarget = base.gameObject;
  12. }
  13. UnityEngine.Object.Destroy(this.m_goTarget);
  14. }
  15. }
  16. public GameObject m_goTarget;
  17. public float m_fDestroyY = -10f;
  18. }