61 lines
2.0 KiB
Lua
61 lines
2.0 KiB
Lua
|
local Action_PlayerDead = {
|
||
|
KillerPlayerKey = 0;
|
||
|
DeadPlayerKey = 0;
|
||
|
}
|
||
|
|
||
|
function Action_PlayerDead:Execute(...)
|
||
|
-- 获取重生的时间
|
||
|
local DeadPC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.DeadPlayerKey);
|
||
|
local DeadPS = UGCGameSystem.GetPlayerStateByPlayerKey(self.DeadPlayerKey);
|
||
|
local KillerPC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.KillerPlayerKey);
|
||
|
|
||
|
UGCGameSystem.GameState:UpdateKDA(self.DeadPlayerKey, self.KillerPlayerKey);
|
||
|
|
||
|
local Assists = DeadPS:GetKillAssists();
|
||
|
if not table.isEmpty(Assists) then
|
||
|
for i, v in pairs(Assists) do
|
||
|
if v.PlayerKey ~= self.KillerPlayerKey then
|
||
|
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(v.PlayerKey);
|
||
|
UGCGameSystem.GameState.TotalPlayerKDA[v.PlayerKey].Assist = (GameState.TotalPlayerKDA[v.PlayerKey].Assist or 0) + 1
|
||
|
PC:OnPlayerAssist(self.DeadPlayerKey, self.KillerPlayerKey);
|
||
|
end
|
||
|
end
|
||
|
DeadPS:ClearKillAssist();
|
||
|
end
|
||
|
|
||
|
DOREPONCE(UGCGameSystem.GameState, "TotalPlayerKDA");
|
||
|
DeadPC:OnSelfDead(self.KillerPlayerKey);
|
||
|
if UE.IsValid(KillerPC) then
|
||
|
KillerPC:OnKillPlayer(self.DeadPlayerKey);
|
||
|
end
|
||
|
|
||
|
UGCGameSystem.GameState:UpdateAlivePlayer(self.DeadPlayerKey, false, self.KillerPlayerKey);
|
||
|
|
||
|
--- 技术分 Add
|
||
|
-- 获取当前的 Soldier Type
|
||
|
if self.KillerPlayerKey ~= 0 or self.KillerPlayerKey ~= nil then
|
||
|
local InType = UGCGameSystem.GameState.PlayerSoldierType[self.KillerPlayerKey]
|
||
|
if InType ~= nil and SoldierConfig.Scores[InType] ~= nil then
|
||
|
for ScoreIndex, Score in pairs(SoldierConfig.Scores[InType]) do
|
||
|
UGCGameSystem.GameState:UpdateScore(self.KillerPlayerKey, ScoreIndex, Score);
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
DOREPONCE(UGCGameSystem.GameState, "PlayerScores");
|
||
|
|
||
|
-- 通知进入观战
|
||
|
if UGCGameSystem.GameState.ProcessState == EventTypes.GameProcessStates.Gaming then
|
||
|
UGCSendRPCSystem.ActorRPCNotify(nil, UGCGameSystem.GameState, "Multi_PlayerDead", self.DeadPlayerKey, self.KillerPlayerKey);
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
--[[
|
||
|
function Action_PlayerRespawn:Update(DeltaSeconds)
|
||
|
|
||
|
end
|
||
|
]]
|
||
|
|
||
|
return Action_PlayerDead;
|