BuffEntity.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. local BuffEntity = class("BuffEntity")
  2. function BuffEntity:ctor(data)
  3. self._data = data
  4. self._actorID = data.actorID
  5. self._buffID = data.buffID
  6. self._param = data.param
  7. self._ol = data.ol
  8. if self._buffID > 10000 then
  9. self._endTime = tonumber(data.param) or GetServerTime()
  10. else
  11. self._endTime = (tonumber(data.param) or 0) + GetServerTime()
  12. end
  13. self._autoRemove= data.autoRemove
  14. self._isInvalid = false
  15. self._visible = true
  16. -- 检测是不是副驾的玩家 副驾玩家的buff特效都不显示出来
  17. local actor = global.actorManager:GetActor(self._actorID)
  18. if actor and actor:IsPlayer() and actor:IsHoreseCopilot() then
  19. self._visible = false
  20. end
  21. end
  22. function BuffEntity:OnEnter()
  23. end
  24. function BuffEntity:OnExit()
  25. end
  26. function BuffEntity:UpdateSfxDir()
  27. return false
  28. end
  29. function BuffEntity:Tick(dt)
  30. if self._autoRemove then
  31. if GetServerTime() > self._endTime then
  32. self:disable()
  33. end
  34. end
  35. end
  36. function BuffEntity:IsInvalid()
  37. return self._isInvalid
  38. end
  39. function BuffEntity:disable()
  40. self._isInvalid = true
  41. end
  42. function BuffEntity:abort()
  43. self:disable()
  44. end
  45. function BuffEntity:GetActorID()
  46. return self._actorID
  47. end
  48. function BuffEntity:GetBuffID()
  49. return self._buffID
  50. end
  51. function BuffEntity:GetData()
  52. return self._data
  53. end
  54. function BuffEntity:GetEndTime()
  55. return self._endTime
  56. end
  57. function BuffEntity:GetParam()
  58. return self._param
  59. end
  60. function BuffEntity:IsAllowAnimUpdate()
  61. return true
  62. end
  63. function BuffEntity:UpdatePresent()
  64. return false
  65. end
  66. function BuffEntity:OnActorStuck()
  67. return false
  68. end
  69. function BuffEntity:UpdateParam(param)
  70. self._param = param
  71. if self._buffID > 10000 then
  72. self._endTime = tonumber(param) or GetServerTime()
  73. else
  74. self._endTime = (tonumber(param) or 0) + GetServerTime()
  75. end
  76. end
  77. function BuffEntity:UpdateOl(ol)
  78. if ol then
  79. self._ol = ol
  80. end
  81. end
  82. function BuffEntity:GetOl()
  83. return self._ol
  84. end
  85. function BuffEntity:setPosition(x, y)
  86. end
  87. function BuffEntity:setVisible(visible)
  88. end
  89. function BuffEntity:updatePosition()
  90. end
  91. return BuffEntity