HideByBoundary.cs 855 B

123456789101112131415161718192021222324252627282930
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. using UnityEngine;
  8. using UnityGameFramework.Runtime;
  9. namespace MetaClient
  10. {
  11. public class HideByBoundary : MonoBehaviour
  12. {
  13. private void OnTriggerExit(Collider other)
  14. {
  15. GameObject go = other.gameObject;
  16. Entity entity = go.GetComponent<Entity>();
  17. if (entity == null)
  18. {
  19. Log.Warning("Unknown GameObject '{0}', you must use entity only.", go.name);
  20. Destroy(go);
  21. return;
  22. }
  23. GameEntry.Entity.HideEntity(entity);
  24. }
  25. }
  26. }