GoodsComponen.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XRTool.Util;
  5. namespace ShadowStudio.Model
  6. {
  7. /// <summary>
  8. /// 物体的组件
  9. /// </summary>
  10. public class GoodsComponen : MonoBehaviour, ArtComponent
  11. {
  12. private ArtContainerHandler container;
  13. public ArtContainerHandler Container { get => container; }
  14. /// <summary>
  15. /// 删除资源
  16. /// </summary>
  17. public virtual void DestroyArt()
  18. {
  19. if (Container)
  20. {
  21. Destroy(Container.gameObject);
  22. }
  23. //Destroy(gameObject);
  24. }
  25. /// <summary>
  26. /// 引用实例
  27. /// </summary>
  28. /// <returns></returns>
  29. public virtual GameObject GetInstace()
  30. {
  31. return gameObject;
  32. }
  33. /// <summary>
  34. /// 发送同步数据
  35. /// </summary>
  36. /// <param name="state"></param>
  37. /// <param name="status"></param>
  38. public virtual void SendTransfer(int state, int status)
  39. {
  40. if (Container != null)
  41. {
  42. Container.SendTransfer(state, status);
  43. }
  44. }
  45. /// <summary>
  46. /// 设置容器
  47. /// </summary>
  48. /// <param name="container"></param>
  49. /// <param name="art"></param>
  50. /// <param name="info"></param>
  51. public virtual void SetContainer(ArtContainerHandler container, Object art, ArtInfo info)
  52. {
  53. this.container = container;
  54. //if (art is GameObject)
  55. //{
  56. // GameObject obj = art as GameObject;
  57. // UnityUtil.SetParent(transform, obj.transform);
  58. //}
  59. }
  60. /// <summary>
  61. /// 同步数据
  62. /// </summary>
  63. /// <param name="goods"></param>
  64. /// <param name="smooth"></param>
  65. public virtual void TransferSyn(GoodsInfo goods, bool smooth = true)
  66. {
  67. }
  68. }
  69. }