56 lines
2.1 KiB
Lua
56 lines
2.1 KiB
Lua
|
local EventAction_PlayerPossessed = {
|
|||
|
-- 可配置参数定义,参数将显示在Action配置面板
|
|||
|
-- 例:
|
|||
|
-- MyIntParameter = 0
|
|||
|
PlayerKey = -1;
|
|||
|
}
|
|||
|
|
|||
|
-- 触发器激活时,将执行Action的Execute
|
|||
|
function EventAction_PlayerPossessed:Execute(...)
|
|||
|
if UGCGameSystem.IsServer() then
|
|||
|
--UGCLogSystem.Log("[EventAction_PlayerPossessed_Execute]1 PlayerKey:%s", tostring(self.PlayerKey))
|
|||
|
local PlayerPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)
|
|||
|
UGCPawnSystem.SetIsInvincible(PlayerPawn, true)
|
|||
|
UGCEventSystem.SetTimer(UGCGameSystem.GameState,
|
|||
|
function()
|
|||
|
PlayerPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)
|
|||
|
if PlayerPawn then
|
|||
|
--UGCLogSystem.Log("[EventAction_PlayerPossessed_Execute]3 PlayerKey:%s", tostring(self.PlayerKey))
|
|||
|
UGCPawnSystem.SetIsInvincible(PlayerPawn, false)
|
|||
|
end
|
|||
|
end,
|
|||
|
GlobalConfigs.GameSetting.InvincibleTime
|
|||
|
)
|
|||
|
|
|||
|
--UGCLogSystem.Log("[EventAction_PlayerPossessed_Execute]2 PlayerKey:%s", tostring(self.PlayerKey))
|
|||
|
--UGCEventSystem.SetTimer(UGCGameSystem.GameState,
|
|||
|
-- function()
|
|||
|
-- if UGCGameSystem.GameState:GetGameStateType() == CustomEnum.EGameState.Playing then
|
|||
|
-- --- 给予玩家出生装备
|
|||
|
-- 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
|