gameActorMoveable.lua 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. local gameActor = require( "actor/gameActor")
  2. local gameActorMoveable = class('gameActorMoveable', gameActor)
  3. function gameActorMoveable:ctor()
  4. gameActorMoveable.super.ctor(self)
  5. end
  6. function gameActorMoveable:init()
  7. gameActorMoveable.super.init(self)
  8. self.mIsArrived = true
  9. self.mIsConfirmed = true
  10. self.mWalkStepTime = global.MMO.DEFAULT_WALK_TIME
  11. self.mWalkSpeedRate = 1
  12. self.mRunStepTime = global.MMO.DEFAULT_RUN_TIME
  13. self.mRunSpeedRate = 1
  14. self.mIsSpeedup = nil
  15. self.mIsFullSpeedup = nil
  16. self.mIsMoreFullSpeedup = nil
  17. self.mIsMoreSpeedRate = nil
  18. self.mAttackStepTime = global.MMO.DEFAULT_ATTACK_TIME
  19. self.mAttackSpeedRate = 1
  20. self.mMagicStepTime = global.MMO.DEFAULT_MAGIC_TIME
  21. self.mMagicSpeedRate = 1
  22. self.mGuildID = ""
  23. self.mGuildName = ""
  24. self.mMasterID = global.MMO.ACTOR_ID_INVALID
  25. self.mFaction = 0
  26. self.pklv = 0
  27. self.inSafeZone = nil
  28. self.mOwnerID = ""
  29. self.mOwnerName = ""
  30. self.mServerID = ""
  31. self.mAdditionZorder = 0
  32. self.mCover = {}
  33. self.mNameColor = nil -- 名字颜色
  34. self.mWarZone = 0 -- 行会战标志
  35. self.mGMData = {} -- gm自定义数据,和服务器约定暂定为5个int
  36. self.mCamps = {
  37. InTeam = false, InGuild = false, InCamp = false
  38. }
  39. end
  40. function gameActorMoveable:destory()
  41. gameActorMoveable.super.destory(self)
  42. end
  43. function gameActorMoveable:GetFaction()
  44. return self.mFaction
  45. end
  46. function gameActorMoveable:SetFaction(faction)
  47. self.mFaction = faction
  48. end
  49. function gameActorMoveable:SetMoveTo( pos )
  50. end
  51. function gameActorMoveable:SetGuildID( id )
  52. self.mGuildID = id
  53. end
  54. function gameActorMoveable:GetGuildID()
  55. return self.mGuildID
  56. end
  57. function gameActorMoveable:SetGuildName( name )
  58. self.mGuildName = name
  59. end
  60. function gameActorMoveable:GetGuildName()
  61. return self.mGuildName
  62. end
  63. function gameActorMoveable:SetCampValue(key, value)
  64. if self.mCamps[key] == value then
  65. return false
  66. end
  67. self.mCamps[key] = value
  68. return true
  69. end
  70. -- 是否己方成员
  71. function gameActorMoveable:IsSameCamp()
  72. local isCamp = self.mCamps.InTeam or self.mCamps.InGuild or self.mCamps.InCamp
  73. return isCamp
  74. end
  75. function gameActorMoveable:GetMasterID()
  76. return self.mMasterID
  77. end
  78. function gameActorMoveable:SetMasterID(id)
  79. self.mMasterID = id
  80. end
  81. function gameActorMoveable:IsHaveMaster()
  82. return self.mMasterID ~= global.MMO.ACTOR_ID_INVALID
  83. end
  84. function gameActorMoveable:SetPKLv(lv)
  85. self.pklv = lv
  86. end
  87. function gameActorMoveable:GetPKLv()
  88. return self.pklv
  89. end
  90. function gameActorMoveable:SetHPHUD(HP, maxHP)
  91. end
  92. function gameActorMoveable:SetIsSpeedup( fast )
  93. self.mIsSpeedup = fast
  94. end
  95. function gameActorMoveable:GetIsSpeedup()
  96. return self.mIsSpeedup
  97. end
  98. function gameActorMoveable:SetIsFullSpeedup( fast )
  99. self.mIsFullSpeedup = fast
  100. end
  101. function gameActorMoveable:GetIsFullSpeedup()
  102. return self.mIsFullSpeedup
  103. end
  104. function gameActorMoveable:SetIsMoreFullSpeedup( fast )
  105. self.mIsMoreFullSpeedup = fast
  106. end
  107. function gameActorMoveable:GetIsMoreFullSpeedup()
  108. return self.mIsMoreFullSpeedup
  109. end
  110. function gameActorMoveable:SetIsMoreSpeedRate( fast )
  111. self.mIsMoreSpeedRate = fast
  112. end
  113. function gameActorMoveable:GetIsMoreSpeedRate()
  114. return self.mIsMoreSpeedRate
  115. end
  116. function gameActorMoveable:SetWalkStepTime( time )
  117. self.mWalkStepTime = time
  118. end
  119. function gameActorMoveable:GetWalkStepTime()
  120. return self.mWalkStepTime
  121. end
  122. function gameActorMoveable:SetWalkSpeed( speed )
  123. self.mWalkSpeedRate = speed
  124. end
  125. function gameActorMoveable:GetWalkSpeed()
  126. if self:GetIsMoreFullSpeedup() then
  127. return self:GetWalkStepTime() / global.MMO.DEFAULT_MORE_MUCH_FAST_TIME
  128. end
  129. if self:GetIsMoreSpeedRate() then
  130. return self.mWalkSpeedRate * global.MMO.DEFAULT_MORE_MUCH_FAST_RATE
  131. end
  132. if self:GetIsFullSpeedup() then
  133. return self.mWalkSpeedRate * global.MMO.DEFAULT_MUCH_FAST_TIME
  134. end
  135. if self:GetIsSpeedup() then
  136. return self.mWalkSpeedRate * global.MMO.DEFAULT_FAST_TIME_RATE
  137. end
  138. return self.mWalkSpeedRate
  139. end
  140. function gameActorMoveable:SetRunStepTime( time )
  141. self.mRunStepTime = time
  142. end
  143. function gameActorMoveable:GetRunStepTime()
  144. return self.mRunStepTime
  145. end
  146. function gameActorMoveable:SetRunSpeed( speed )
  147. self.mRunSpeedRate = speed
  148. end
  149. function gameActorMoveable:GetRunSpeed()
  150. if self:GetIsMoreFullSpeedup() then
  151. return self:GetRunStepTime() / global.MMO.DEFAULT_MORE_MUCH_FAST_TIME
  152. end
  153. if self:GetIsMoreSpeedRate() then
  154. return self.mRunSpeedRate * global.MMO.DEFAULT_MORE_MUCH_FAST_RATE
  155. end
  156. if self:GetIsFullSpeedup() then
  157. return self.mRunSpeedRate * global.MMO.DEFAULT_MUCH_FAST_TIME
  158. end
  159. if self:GetIsSpeedup() then
  160. return self.mRunSpeedRate * global.MMO.DEFAULT_FAST_TIME_RATE
  161. end
  162. return self.mRunSpeedRate
  163. end
  164. function gameActorMoveable:SetAttackStepTime( time )
  165. self.mAttackStepTime = time
  166. end
  167. function gameActorMoveable:GetAttackStepTime()
  168. return self.mAttackStepTime
  169. end
  170. function gameActorMoveable:SetAttackSpeed( speed )
  171. self.mAttackSpeedRate = speed
  172. end
  173. function gameActorMoveable:GetAttackSpeed()
  174. if self:GetIsMoreFullSpeedup() then
  175. return self:GetAttackStepTime() / global.MMO.DEFAULT_MORE_MUCH_FAST_TIME
  176. end
  177. if self:GetIsMoreSpeedRate() then
  178. return self.mAttackSpeedRate * global.MMO.DEFAULT_MORE_MUCH_FAST_RATE
  179. end
  180. if self:GetIsFullSpeedup() then
  181. return self.mAttackSpeedRate * global.MMO.DEFAULT_MUCH_FAST_TIME
  182. end
  183. if self:GetIsSpeedup() then
  184. return self.mAttackSpeedRate * global.MMO.DEFAULT_FAST_TIME_RATE
  185. end
  186. return self.mAttackSpeedRate
  187. end
  188. function gameActorMoveable:GetAttackAnimSpeed( action )
  189. return self:GetAttackSpeed()
  190. end
  191. function gameActorMoveable:SetMagicStepTime( time )
  192. self.mMagicStepTime = time
  193. end
  194. function gameActorMoveable:GetMagicStepTime()
  195. return self.mMagicStepTime
  196. end
  197. function gameActorMoveable:SetMagicSpeed( speed )
  198. self.mMagicSpeedRate = speed
  199. end
  200. function gameActorMoveable:GetMagicSpeed()
  201. if self:GetIsMoreFullSpeedup() then
  202. return self:GetMagicStepTime() / global.MMO.DEFAULT_MORE_MUCH_FAST_TIME
  203. end
  204. if self:GetIsMoreSpeedRate() then
  205. return self.mMagicSpeedRate * global.MMO.DEFAULT_MORE_MUCH_FAST_RATE
  206. end
  207. if self:GetIsFullSpeedup() then
  208. return self.mMagicSpeedRate * global.MMO.DEFAULT_MUCH_FAST_TIME
  209. end
  210. if self:GetIsSpeedup() then
  211. return self.mMagicSpeedRate * global.MMO.DEFAULT_FAST_TIME_RATE
  212. end
  213. return self.mMagicSpeedRate
  214. end
  215. function gameActorMoveable:GetMagicAnimSpeed( action )
  216. return self:GetMagicSpeed()
  217. end
  218. function gameActorMoveable:SetGameActorActionHandler(handler)
  219. end
  220. function gameActorMoveable:GetGameActorActionHandler()
  221. end
  222. function gameActorMoveable:dirtyAnimFlag()
  223. end
  224. function gameActorMoveable:stopAnimToFrame( frameIndex )
  225. end
  226. function gameActorMoveable:SetAdditionZorder( zorder )
  227. self.mAdditionZorder = zorder
  228. end
  229. function gameActorMoveable:GetAdditionZorder()
  230. return self.mAdditionZorder
  231. end
  232. function gameActorMoveable:SetInSafeZone(inSafe)
  233. self.inSafeZone = inSafe
  234. end
  235. function gameActorMoveable:GetInSafeZone()
  236. return self.inSafeZone
  237. end
  238. function gameActorMoveable:SetIsThrough(through)
  239. self.isThrough = through
  240. end
  241. function gameActorMoveable:IsThroughAble()
  242. return self.isThrough == 1
  243. end
  244. function gameActorMoveable:SetOwnerName(name)
  245. self.mOwnerName = name
  246. end
  247. function gameActorMoveable:GetOwnerName()
  248. return self.mOwnerName
  249. end
  250. function gameActorMoveable:SetOwnerID(id)
  251. self.mOwnerID = id
  252. end
  253. function gameActorMoveable:GetOwnerID()
  254. return self.mOwnerID
  255. end
  256. function gameActorMoveable:SetServerID(id)
  257. self.mServerID = id
  258. end
  259. function gameActorMoveable:GetServerID()
  260. return self.mServerID
  261. end
  262. function gameActorMoveable:Bright()
  263. if not self.mIsBright then
  264. self.mIsBright = true
  265. local actorAnim = self:GetAnimation()
  266. global.Facade:sendNotification(global.NoticeTable.HighLightNodeShader, actorAnim, global.MMO.SHADER_TYPE_HIGHTLIGHT)
  267. end
  268. end
  269. function gameActorMoveable:UnBright()
  270. if self.mIsBright then
  271. self.mIsBright = false
  272. local actorAnim = self:GetAnimation()
  273. global.Facade:sendNotification( global.NoticeTable.NormalNodeShader, { node = actorAnim } )
  274. end
  275. end
  276. function gameActorMoveable:IsBright()
  277. return self.mIsBright
  278. end
  279. function gameActorMoveable:IsArrived()
  280. return self.mIsArrived
  281. end
  282. function gameActorMoveable:SetIsArrived(b)
  283. self.mIsArrived = b
  284. end
  285. function gameActorMoveable:GetConfirmed()
  286. return self.mIsConfirmed
  287. end
  288. function gameActorMoveable:SetConfirmed(b)
  289. self.mIsConfirmed = b
  290. end
  291. function gameActorMoveable:SetNameColor(state)
  292. self.mNameColor = state
  293. end
  294. function gameActorMoveable:GetNameColor(state)
  295. return self.mNameColor
  296. end
  297. function gameActorMoveable:SetWarZone(state)
  298. self.mWarZone = state
  299. end
  300. function gameActorMoveable:IsWarZone()
  301. return self.mWarZone == 1
  302. end
  303. function gameActorMoveable:SetGMData(data)
  304. self.mGMData = data
  305. end
  306. function gameActorMoveable:GetGMData()
  307. return self.mGMData
  308. end
  309. function gameActorMoveable:SetShaBaKeZone(value)
  310. self.mShabakeZone = value
  311. end
  312. function gameActorMoveable:GetShaBaKeZone()
  313. return self.mShabakeZone
  314. end
  315. return gameActorMoveable