Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. -- The below section displays an icon if the player is in the cone behind their target
  2.  
  3. local playerPos = GameLib.GetPlayerUnit():GetPosition()
  4.  
  5. local vecTargToPlayer = Vector3.New(targetPos.x - playerPos.x, 0, targetPos.z - playerPos.z)
  6. vecTargToPlayer = vecTargToPlayer:Normal()
  7.  
  8. local nDotTargPlayer = Vector3.Dot(vecTargToPlayer, vecTargetFacing)
  9.  
  10. if nDotTargPlayer >= cos135 then
  11.  
  12. if not self.wndNotification:IsShown() then
  13.  
  14. if self.settings.anchor then
  15. self.wndNotification:SetAnchorOffsets(unpack(self.settings.anchor))
  16. end
  17. self.wndNotification:Show(true)
  18. end
  19. else
  20. self.wndNotification:Show(false)
  21. end
  22.  
  23. end
  24.  
  25. function FromBehind:OnRestore(eType, t)
  26.  
  27. if eType ~= GameLib.CodeEnumAddonSaveLevel.Character then return end
  28.  
  29. self.settings = {}
  30.  
  31. self.settings = t
  32.  
  33. self:MoreDots()
  34. end
  35.  
  36.  
  37. function FromBehind:OnSave(eType)
  38. if eType == GameLib.CodeEnumAddonSaveLevel.Character then
  39. self.settings.anchor = {self.wndNotification:GetAnchorOffsets()}
  40. return self.settings
  41. end
  42. end
  43.  
  44. -----------------------------------------------------------------------------------------------
  45. -- FromBehind Instance
  46. -----------------------------------------------------------------------------------------------
  47. local FromBehindInst = FromBehind:new()
  48. FromBehindInst:Init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement