32 lines
1.1 KiB
Lua
32 lines
1.1 KiB
Lua
|
local Action_PlayerRespawn = {
|
||
|
PlayerKey = 0,
|
||
|
bIsAI = false,
|
||
|
}
|
||
|
|
||
|
function Action_PlayerRespawn:Execute(...)
|
||
|
if self.bIsAI == true then
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
local PlayerState = UGCGameSystem.GetPlayerStateByPlayerKey(self.PlayerKey)
|
||
|
local PlayerController = UGCGameSystem.GetPlayerControllerByPlayerKey(self.PlayerKey)
|
||
|
if UGCGameSystem.GameState and PlayerState and PlayerController then
|
||
|
UE.Log("[Action_PlayerRespawn:Execute] PlayerKey = %d, PlayerName = %s", self.PlayerKey, PlayerState.PlayerName)
|
||
|
local PlayerData = UGCGameSystem.GameState.PlayerDataList[self.PlayerKey]
|
||
|
if PlayerData ~= nil then
|
||
|
PlayerData.IsDead = false
|
||
|
end
|
||
|
|
||
|
-- 玩家死亡次数
|
||
|
local PlayerDieData = UGCGameSystem.GameState.PlayerDieTimes[self.PlayerKey]
|
||
|
if PlayerDieData == nil then
|
||
|
UGCGameSystem.GameState.PlayerDieTimes[self.PlayerKey] = 1
|
||
|
else
|
||
|
UGCGameSystem.GameState.PlayerDieTimes[self.PlayerKey] = UGCGameSystem.GameState.PlayerDieTimes[self.PlayerKey] + 1
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
return Action_PlayerRespawn
|