45 lines
1.4 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
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