2025-01-04 23:00:19 +08:00

35 lines
1.2 KiB
Lua

---@class WB_MarkAttackPoint_C:ObjectPositionWidget
---@field CanvasPanel_DistanceInfo UCanvasPanel
---@field Image_1 UImage
---@field Image_SiteBg1 UImage
---@field TextBlock_0 UTextBlock
---@field TextBlock_Distance UTextBlock
---@field WidgetSwitcher_IsAttack UWidgetSwitcher
--Edit Below--
local WB_MarkAttackPoint = { bInitDoOnce = false; };
function WB_MarkAttackPoint:Construct()
--UGCEventSystem.SetTimerLoop(self, self.UpdateInfo, 0.2)
end
function WB_MarkAttackPoint:UpdateInfo(AttackPointActor)
if UE.IsValid(AttackPointActor) then
local TargetActor = UGCSystemLibrary.GetLocalPlayerController()
local LocalPawn = UGCSystemLibrary.GetLocalPlayerPawn()
if UE.IsValid(LocalPawn) and not UGCPawnSystem.HasPawnState(LocalPawn, EPawnState.Dead) then
TargetActor = LocalPawn
end
self.TextBlock_Distance:SetText(string.format("%.0fm", VectorHelper.GetDistance(TargetActor:K2_GetActorLocation(), AttackPointActor:K2_GetActorLocation())/ 100))
self.WidgetSwitcher_IsAttack:SetActiveWidgetIndex(UGCGameSystem.GameState:PlayerIsAttacker(UGCSystemLibrary.GetLocalPlayerKey()) and 1 or 0)
end
end
-- function WB_MarkAttackPoint:Destruct()
-- end
return WB_MarkAttackPoint;