45 lines
1.4 KiB
Lua
45 lines
1.4 KiB
Lua
local EventAction_PlayerPossessed = {
|
||
-- 可配置参数定义,参数将显示在Action配置面板
|
||
-- 例:
|
||
-- MyIntParameter = 0
|
||
PlayerKey = -1;
|
||
}
|
||
|
||
-- 触发器激活时,将执行Action的Execute
|
||
function EventAction_PlayerPossessed:Execute(...)
|
||
if UGCGameSystem.IsServer() then
|
||
local PlayerPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)
|
||
|
||
UGCEventSystem.SetTimer(UGCGameSystem.GameState,
|
||
function()
|
||
if UGCGameSystem.GameState:GetGameStateType() == CustomEnum.EGameState.Playing then
|
||
--- 给予玩家武器配置
|
||
-- UGCGameSystem.GameState:RefreshPlayerWeapons(self.PlayerKey)
|
||
--- 给予玩家出生装备
|
||
PlayerPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)
|
||
if PlayerPawn then
|
||
for _, ItemData in pairs(GlobalConfigs.GameSetting.BeBornItems) do
|
||
UGCBackPackSystem.AddItem(PlayerPawn, ItemData.ItemID, ItemData.Count)
|
||
end
|
||
end
|
||
end
|
||
|
||
end,
|
||
0.1
|
||
)
|
||
end
|
||
|
||
|
||
|
||
return true
|
||
end
|
||
|
||
--[[
|
||
-- 需要勾选Action的EnableTick,才会执行Update
|
||
-- 触发器激活后,将在每个tick执行Action的Update,直到self.bEnableActionTick为false
|
||
function EventAction_PlayerPossessed:Update(DeltaSeconds)
|
||
|
||
end
|
||
]]
|
||
|
||
return EventAction_PlayerPossessed |