PutDownBoxManager.cs 807 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [RequireComponent(typeof(Collider))]
  5. public class PutDownBoxManager : MonoBehaviour
  6. {
  7. private static PutDownBoxManager _putDownBoxManager;
  8. public static PutDownBoxManager Instance
  9. {
  10. get
  11. {
  12. if (_putDownBoxManager == null)
  13. {
  14. Debug.LogWarning("未实例化PutDownBoxManager");
  15. }
  16. return _putDownBoxManager;
  17. }
  18. }
  19. private void Awake()
  20. {
  21. _putDownBoxManager = this;
  22. _bounds = this.GetComponent<Collider>().bounds;
  23. }
  24. private Bounds _bounds;
  25. public bool TestBounds(Vector3 pos)
  26. {
  27. if (_bounds.Contains(pos))
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. }