46 lines
1.6 KiB
Lua
46 lines
1.6 KiB
Lua
|
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
|