UGCProjects/ProjectTemp_T/Script/gamemode/Action_PlayerInvincible.lua

46 lines
1.6 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
local Action_PlayerInvincible = {
-- 可配置参数定义参数将显示在Action配置面板
-- 例:
-- MyIntParameter = 0
IsAI = false,
RespawnPlayerKey = 0,
}
-- 触发器激活时将执行Action的Execute
function Action_PlayerInvincible:Execute(...)
if self.IsAI then
return true
end
local TargetController = UGCGameSystem.GetPlayerControllerByPlayerKey(self.RespawnPlayerKey)
local TargetPlayer = UGCGameSystem.GetPlayerPawnByPlayerKey(self.RespawnPlayerKey)
if not UE.IsValid(TargetController) or not UE.IsValid(TargetPlayer) then
UGCLogSystem.Log("[Action_PlayerInvincible_Execute] RespawnPlayerKey Failure:%d", self.RespawnPlayerKey)
return true
end
-- 因为测试出这个引擎客户端有时候不调BeginPlay所以改发RPC
UnrealNetwork.CallUnrealRPC(TargetController, TargetController, "Client_PlayerRespwan")
-- UGCLogSystem.Log("[Action_PlayerInvincible_Execute] Time:%f", KismetSystemLibrary.GetGameTimeInSeconds(self))
-- 设置无敌
-- UGCPawnSystem.SetIsInvincible(self, true)
-- UGCEventSystem.SetTimer(TargetController,
-- function ()
-- -- UGCPawnSystem.SetIsInvincible(TargetPlayer, false)
-- end,
-- Tables.GameParam.InvincibleTime --self.InvincibleTime
-- )
return true
end
--[[
-- 需要勾选Action的EnableTick才会执行Update
-- 触发器激活后将在每个tick执行Action的Update直到self.bEnableActionTick为false
function Action_PlayerInvincible:Update(DeltaSeconds)
end
]]
return Action_PlayerInvincible