47 lines
1.3 KiB
Lua
47 lines
1.3 KiB
Lua
PawnTool = {};
|
|
|
|
---@type table<PlayerKey, bool>
|
|
PawnTool.IsPlayersShow = {};
|
|
|
|
--- 客户端执行 隐藏玩家
|
|
---@param InPlayerKey PlayerKey
|
|
function PawnTool.HidePawn(InPlayerKey, IsHide)
|
|
if IsClient then
|
|
if IsHide == nil then IsHide = true; end
|
|
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(InPlayerKey);
|
|
if UE.IsValidPawn(Pawn) then
|
|
Pawn:HiddenMySelf(IsHide);
|
|
PawnTool.IsPlayersShow[InPlayerKey] = not IsHide;
|
|
end
|
|
end
|
|
end
|
|
|
|
--- 客户端执行,显示玩家
|
|
function PawnTool.ShowPawn(InPlayerKey, IsShow)
|
|
if IsClient then
|
|
if IsShow == nil then IsShow = true; end
|
|
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(InPlayerKey)
|
|
if UE.IsValidPawn(Pawn) then
|
|
Pawn:HiddenMySelf(not IsShow);
|
|
PawnTool.IsPlayersShow[InPlayerKey] = IsShow;
|
|
end
|
|
end
|
|
end
|
|
|
|
--- 打开 Pawn 的描边
|
|
function PawnTool.OpenPawnOutline(InPlayerKey, IsShow)
|
|
if IsClient then
|
|
if IsShow == nil then IsShow = true; end
|
|
STExtraBlueprintFunctionLibrary.EnablePlayerAvatarOutline(self, IsShow);
|
|
UGCGameSystem.GameState:RegisterPostProcessMgr(self);
|
|
end
|
|
end
|
|
|
|
---@param Pawn UGCPlayerPawn_C
|
|
---@param IsInvincible boolean
|
|
function PawnTool.SetInvincible(Pawn, IsInvincible)
|
|
if IsInvincible == nil then IsInvincible = true; end
|
|
Pawn:SetInvincible(IsInvincible);
|
|
end
|
|
|