UGCProjects/GZJ/Script/gamemode/Action_PlayerKilled.lua

23 lines
739 B
Lua
Raw Permalink Normal View History

2025-01-08 22:46:12 +08:00
local Action_PlayerKilled = {
KillerKey = 0, --杀手Key
PlayerKey = 0, --被杀死玩家Key
}
function Action_PlayerKilled:Execute(...)
local PlayerState = UGCGameSystem.GetPlayerStateByPlayerKey(self.PlayerKey)
if UGCGameSystem.GameState and PlayerState then
UE.Log("[Action_PlayerKilled:Execute] PlayerName = "..PlayerState.PlayerName)
local PlayerData = UGCGameSystem.GameState.PlayerDataList[self.PlayerKey]
if PlayerData ~= nil then
PlayerData.IsDead = true
end
local RespawnComponent = UGCGameSystem.GetRespawnComponent()
RespawnComponent:AddRespawnPlayerWithTime(self.PlayerKey, 5.0)
end
return true
end
return Action_PlayerKilled