UGCProjects/ProjectTemp_T/Script/gamemode/Action_PlayerRespawn.lua

36 lines
1.2 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
local Action_PlayerRespawn = {
-- 可配置参数定义参数将显示在Action配置面板
-- 例:
-- MyIntParameter = 0
PlayerKey = 0;
}
-- 注意:玩家
function Action_PlayerRespawn:Execute(...)
-- 先尝试在此处进行设置玩家背包物品,如果不行,
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.PlayerKey)
if UE.IsValid(Pawn) then
--PC:EquipSelf();
Pawn:OnSetSoldierType(UGCGameSystem.GameState.PlayerSoldierType[self.PlayerKey]);
-- 通知当前复活了
UGCSendRPCSystem.ActorRPCNotify(self.PlayerKey, PC, "Client_CanSpectateOthers", 2)
--UnrealNetwork.CallUnrealRPC(PC, PC, "Client_CanSpectateOthers", 2);
else
UGCLogSystem.Log("[Action_PlayerRespawn:Execute] 没有找到 Pawn")
end
return true;
end
--[[
-- 需要勾选Action的EnableTick才会执行Update
-- 触发器激活后将在每个tick执行Action的Update直到self.bEnableActionTick为false
function Action_PlayerRespawn:Update(DeltaSeconds)
end
]]
return Action_PlayerRespawn;