PoolObject.cs 697 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /// <summary>
  5. /// 被对象池管理的对象
  6. /// </summary>
  7. public class PoolObject : MonoBehaviour
  8. {
  9. public bool SetActive = true;
  10. /// <summary>
  11. /// 对象初始化时调用
  12. /// </summary>
  13. public virtual void OnCreate()
  14. {
  15. }
  16. /// <summary>
  17. /// 从对象池中取出时调用
  18. /// </summary>
  19. public virtual void OnFetch()
  20. {
  21. }
  22. /// <summary>
  23. /// 被回收时调用
  24. /// </summary>
  25. public virtual void OnRecycle()
  26. {
  27. }
  28. /// <summary>
  29. /// 被销毁时调用
  30. /// </summary>
  31. public virtual void OnObjectDestroy()
  32. {
  33. }
  34. }