560 lines
22 KiB
Lua
560 lines
22 KiB
Lua
---@class UGCPlayerPawn_C:BP_UGCPlayerPawn_C
|
|
--Edit Below--
|
|
---@type UGCPlayerPawn_C
|
|
local UGCPlayerPawn = {
|
|
---- 成神进度
|
|
--ToGodSchedule = 0;
|
|
---- 可获得的增益次数
|
|
--CanObtainIncreaseCount = 0;
|
|
---- 当前可选择的增益
|
|
--NowCanSelectIncrease = {};
|
|
---- 拥有的增益
|
|
--OwnedIncrease = {}; -- [IncreaseType] = Level
|
|
---- 增益已满
|
|
--IncreaseIsFull = false;
|
|
|
|
-- Attr -------------------------
|
|
-- 伤害缩放
|
|
Attr_DamageScale = 1;
|
|
-- 防御缩放
|
|
Attr_DefenseScale = 1;
|
|
-- 闪避概率
|
|
Attr_Dodge = 0;
|
|
--
|
|
-- Attr End ---------------------
|
|
};
|
|
|
|
-- Replicated -------------------------------------------------------------------------------------------------------
|
|
function UGCPlayerPawn:GetReplicatedProperties()
|
|
return
|
|
--"ToGodSchedule",
|
|
--"CanObtainIncreaseCount",
|
|
--"NowCanSelectIncrease",
|
|
--"OwnedIncrease"
|
|
end
|
|
|
|
|
|
--function UGCPlayerPawn:OnRep_ToGodSchedule()
|
|
-- if UGCEventSystem then
|
|
-- UGCEventSystem.SendEvent(EventEnum.UpdateToGodSchedule, self, self.ToGodSchedule)
|
|
-- end
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:OnRep_CanObtainIncreaseCount()
|
|
-- if UGCEventSystem then
|
|
-- UGCEventSystem.SendEvent(EventEnum.UpdateCanObtainIncreaseCount, self, self.CanObtainIncreaseCount)
|
|
-- end
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:OnRep_NowCanSelectIncrease()
|
|
-- if UGCEventSystem then
|
|
-- UGCEventSystem.SendEvent(EventEnum.UpdateNowCanSelectIncrease, self, self.NowCanSelectIncrease)
|
|
-- end
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:OnRep_OwnedIncrease()
|
|
-- if UGCEventSystem then
|
|
-- UGCEventSystem.SendEvent(EventEnum.UpdateOwnedIncrease, self, self.OwnedIncrease)
|
|
-- end
|
|
--end
|
|
|
|
-- Replicated End ---------------------------------------------------------------------------------------------------
|
|
|
|
-- Attr -------------------------------------------------------------------------------------------------------------
|
|
|
|
function UGCPlayerPawn:SetDamageScale(InDamageScale)
|
|
self.Attr_DamageScale = InDamageScale
|
|
end
|
|
|
|
function UGCPlayerPawn:GetDamageScale()
|
|
return self.Attr_DamageScale
|
|
end
|
|
|
|
function UGCPlayerPawn:SetDefenseScale(InDefenseScale)
|
|
-- 防御值不能小于0
|
|
if InDefenseScale <= 0 then return false end
|
|
self.Attr_DefenseScale = InDefenseScale
|
|
return true
|
|
end
|
|
|
|
function UGCPlayerPawn:GetDefenseScale()
|
|
return self.Attr_DefenseScale
|
|
end
|
|
|
|
function UGCPlayerPawn:SetDodge(InDodge)
|
|
self.Attr_Dodge = InDodge
|
|
return true
|
|
end
|
|
|
|
function UGCPlayerPawn:GetDodge()
|
|
return self.Attr_DefenseScale
|
|
end
|
|
|
|
|
|
|
|
-- Attr End ---------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- 关闭盒子掉落
|
|
function UGCPlayerPawn:IsSkipSpawnDeadTombBox(EventInstigater)
|
|
return true
|
|
end
|
|
|
|
function UGCPlayerPawn:ReceiveBeginPlay()
|
|
self.SuperClass.ReceiveBeginPlay(self);
|
|
--- 设置翻墙功能
|
|
self.bVaultIsOpen = true
|
|
--- 设置滑铲功能
|
|
self.IsOpenShovelAbility = true
|
|
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerBeginPlay, self)
|
|
|
|
if self:HasAuthority() then
|
|
self:AddEvent()
|
|
if UE.IsValid(self:GetController()) then
|
|
self:ReceivePossessed(self:GetController())
|
|
UGCLogSystem.Log("[UGCPlayerPawn_ReceiveBeginPlay] Controller Is Valid")
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
end
|
|
end
|
|
|
|
--- 客户端必定执行的BeginPlay
|
|
function UGCPlayerPawn:ClientMustBeExeBeginPlay()
|
|
if self.DoOnceMustBeExeBeginPlay then return end
|
|
self.DoOnceMustBeExeBeginPlay = true
|
|
self.ClientUpdatedPlayerKey = false
|
|
--local MainControlPanel = UGCWidgetManagerSystem.GetMainUI()
|
|
--if UE.IsValid(MainControlPanel) then
|
|
-- MainControlPanel.MainControlBaseUI.ChangeSight_UIBP:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
-- -- MainControlPanel.MainControlBaseUI.ChangeSight_UIBP:ShowList(); --- 倍镜切换
|
|
--end
|
|
end
|
|
|
|
|
|
function UGCPlayerPawn:ReceivePossessed(NewController)
|
|
self.SuperClass.ReceivePossessed(self, NewController);
|
|
UGCLogSystem.Log("[UGCPlayerPawn_ReceivePossessed] PlayerKey:%s", tostring(NewController.PlayerKey))
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerPossessed, NewController.PlayerKey)
|
|
UGCGameSystem.GameState:SetPlayerIsAlive(NewController.PlayerKey, self)
|
|
|
|
if UGCSystemLibrary.GetIsPreparationState() then
|
|
UGCSystemLibrary.SetPlayerPawnMovable(self, false)
|
|
end
|
|
|
|
---- 设置上条命保存的Buff
|
|
--self.OwnedIncrease = NewController:GetOwnedIncrease()
|
|
--for IncreaseType, Level in pairs(self.OwnedIncrease) do
|
|
-- BuffSystemAPI.PlayerAddBuff(self, GodOfWarConfig.BuffList[IncreaseType][Level])
|
|
--end
|
|
---- 初始化上条命的进度
|
|
--self:AddToGodSchedule(NewController:GetToGodSchedule())
|
|
---- 初始化上条命可选择的增益
|
|
--self:SetNowCanSelectIncrease(NewController:GetNowCanSelectIncrease())
|
|
---- 初始化上条命可选择的增益数
|
|
--self:SetCanObtainIncreaseCount(NewController:GetCanObtainIncreaseCount())
|
|
--
|
|
---- 增加一个增益
|
|
--self:AddCanObtainIncreaseCount()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function UGCPlayerPawn:ReceiveTick(DeltaTime)
|
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
|
if not UGCGameSystem.IsServer() then
|
|
self:ClientMustBeExeBeginPlay()
|
|
self:UpdatePlayerKey()
|
|
--local HeadPos = self.Mesh:GetSocketLocation("head")
|
|
--UGCLogSystem.Log("[UGCPlayerPawn_ReceiveTick]HeadPos:%s, ActorPos:%s", VectorHelper.ToString(HeadPos), VectorHelper.ToString(self:K2_GetActorLocation()))
|
|
end
|
|
end
|
|
|
|
function UGCPlayerPawn:ReceiveEndPlay()
|
|
self:RemoveEvent()
|
|
self.SuperClass.ReceiveEndPlay(self);
|
|
end
|
|
|
|
|
|
function UGCPlayerPawn:AddEvent()
|
|
if self:HasAuthority() then
|
|
self.DeadNotifyDelegate:Add(self.PlayerDead, self)
|
|
self.DamageNotifyDelegate:Add(self.PlayerInjury, self)
|
|
else
|
|
end
|
|
end
|
|
|
|
function UGCPlayerPawn:RemoveEvent()
|
|
if self:HasAuthority() then
|
|
self.DeadNotifyDelegate:Remove(self.PlayerDead, self)
|
|
self.DamageNotifyDelegate:Remove(self.PlayerInjury, self)
|
|
|
|
|
|
if self.CheckBornItemsHandle then
|
|
UGCEventSystem.StopTimer(self.CheckBornItemsHandle)
|
|
self.CheckBornItemsHandle = nil
|
|
end
|
|
if self.CheckWeaponAndPartsHandle then
|
|
UGCEventSystem.StopTimer(self.CheckWeaponAndPartsHandle)
|
|
self.CheckWeaponAndPartsHandle = nil
|
|
end
|
|
else
|
|
end
|
|
end
|
|
|
|
|
|
function UGCPlayerPawn:CheckWeaponAndParts()
|
|
UGCGameSystem.GameState:CheckWeaponAndParts(self.PlayerKey)
|
|
end
|
|
|
|
|
|
|
|
function UGCPlayerPawn:CheckBornItems()
|
|
UGCLogSystem.Log("[UGCPlayerPawn_CheckBornItems] PlayerKey:%s", tostring(self.PlayerKey))
|
|
UGCLogSystem.LogTree("[UGCPlayerPawn_CheckBornItems]", self.DefaultBackPack)
|
|
for i = #self.DefaultBackPack, 1, -1 do
|
|
local ItemID = self.DefaultBackPack[i].ItemID
|
|
local Count = self.DefaultBackPack[i].Count
|
|
local InstCount = UGCBackPackSystem.GetItemCount(self, ItemID)
|
|
if InstCount >= Count then
|
|
UGCLogSystem.Log("[UGCPlayerPawn_CheckBornItems] i:%s", tostring(i))
|
|
table.remove(self.DefaultBackPack, i)
|
|
UGCLogSystem.LogTree("[UGCPlayerPawn_CheckBornItems]", self.DefaultBackPack)
|
|
else
|
|
UGCBackPackSystem.AddItem(self, ItemID, Count - InstCount)
|
|
end
|
|
end
|
|
if #self.DefaultBackPack == 0 then
|
|
UGCEventSystem.StopTimer(self.CheckBornItemsHandle)
|
|
self.CheckBornItemsHandle = nil
|
|
UGCLogSystem.Log("[UGCPlayerPawn_CheckBornItems] Succeed PlayerKey:%s", tostring(self.PlayerKey));
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------- Delegate --------------------------------------------------
|
|
|
|
---@param DamageInfo FDamageInfoCollection
|
|
---@return VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue uint, uint, int, EDamageType, bool, float, float
|
|
function UGCPlayerPawn:GetDamageInfoCollectionInfo(DamageInfo)
|
|
local CauserController = DamageInfo.Instigator
|
|
local WeaponID = -1
|
|
local CauserKey = CauserController and CauserController.PlayerKey or -1
|
|
local VictimKey = self.PlayerKey
|
|
local CauserItemID = DamageInfo.CauserItemID
|
|
--- 近战投掷、投掷手雷
|
|
if CauserItemID then
|
|
WeaponID = CauserItemID
|
|
end
|
|
UGCLogSystem.Log("[UGCPlayerPawn_GetDamageInfoCollectionInfo] WeaponID:%d", WeaponID)
|
|
local Distance = 0.
|
|
if CauserController and CauserController.Pawn then
|
|
Distance = VectorHelper.GetDistance(self:K2_GetActorLocation(), CauserController.Pawn:K2_GetActorLocation())
|
|
end
|
|
|
|
local IsHeadShotDamage = (DamageInfo.Hit.BoneName == "head")
|
|
return VictimKey, CauserKey, WeaponID, DamageInfo.DamageType, IsHeadShotDamage, Distance, DamageInfo.Damage
|
|
end
|
|
|
|
---@param DamageInfo FDamageInfoCollection
|
|
function UGCPlayerPawn:PlayerDead(DamageInfo)
|
|
UGCLogSystem.LogTree("[UGCPlayerPawn_PlayerDead] DamageInfo:", UE.ToTable(DamageInfo))
|
|
local VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue = self:GetDamageInfoCollectionInfo(DamageInfo)
|
|
UGCSendRPCSystem.RPCEvent(nil, EventEnum.PlayerDeathInfo, VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue)
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerDeathInfo, VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue)
|
|
UGCGameSystem.GameState:SetPlayerIsAlive(VictimKey, nil)
|
|
end
|
|
|
|
---@param DamageInfo FDamageInfoCollection
|
|
---@param ReturnValue float
|
|
function UGCPlayerPawn:PlayerInjury(DamageInfo)
|
|
local VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue = self:GetDamageInfoCollectionInfo(DamageInfo)
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerInjuryInfo, VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue)
|
|
UGCSendRPCSystem.RPCEvent(CauserKey, EventEnum.PlayerInjuryInfo, VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue)
|
|
end
|
|
|
|
function UGCPlayerPawn:OnDeathCallBack(DeadCharacter,Killer,DamageCauser,KillingHitInfo,KillingHitImpulseDir,KillingHitDamageTypeID,DamageTypeClass,IsHeadShotDamage)
|
|
local CauserKey = Killer and Killer.PlayerKey
|
|
local WeaponID = -1
|
|
local DamageType = EDamageType.UGCCustomDamageType + 1
|
|
UGCLogSystem.Log("[UGCPlayerPawn_TestOnDeath] PlayerKey:%s, CauserKey:%s", tostring(self.PlayerKey), tostring(CauserKey))
|
|
UGCSendRPCSystem.RPCEvent(nil, EventEnum.PlayerDeathInfo, self.PlayerKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, 0, 0)
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerDeathInfo, self.PlayerKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, 0, 0)
|
|
UGCGameSystem.GameState:SetPlayerIsAlive(self.PlayerKey, nil)
|
|
end
|
|
|
|
------------------------------------------------ Delegate End ------------------------------------------------
|
|
|
|
|
|
|
|
|
|
------------------------------------------------ ModifyDamage ------------------------------------------------
|
|
---@field UGC_TakeDamageOverrideEvent:fun(Damage:float,DamageType:EDamageType,EventInstigator:AController,DamageCauser:AActor,Hit:FHitResult):float
|
|
function UGCPlayerPawn:UGC_TakeDamageOverrideEvent(Damage, DamageType, EventInstigator, DamageCauser, Hit)
|
|
local DamageAmount = Damage
|
|
UGCLogSystem.Log("[UGCPlayerPawn_UGC_TakeDamageOverrideEvent] InDamageAmount:%s", tostring(DamageAmount))
|
|
if EventInstigator and EventInstigator.PlayerKey then
|
|
local CauserTeamID = UGCPlayerStateSystem.GetTeamID(EventInstigator.PlayerKey)
|
|
local SelfTeamID = UGCPlayerStateSystem.GetTeamID(self.PlayerKey)
|
|
|
|
local CauserPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(EventInstigator.PlayerKey)
|
|
local DamageScale = CauserPawn and CauserPawn:GetDamageScale() or 1
|
|
|
|
if EventInstigator.PlayerKey == self.PlayerKey and GlobalConfigs.GameSetting.bEnableSelfHarm then
|
|
--- 对自己的伤害
|
|
DamageAmount = GlobalConfigs.GameSetting.SelfHarmInjuryRatio * DamageAmount
|
|
else
|
|
--- 伤害设置(友方、敌方)
|
|
DamageAmount = (CauserTeamID == SelfTeamID and GlobalConfigs.GameSetting.FriendlyInjuryRatio * DamageAmount or DamageAmount) * DamageScale / self:GetDefenseScale()
|
|
end
|
|
|
|
elseif DamageCauser and DamageCauser:GetOwner() then
|
|
UGCLogSystem.Log("[UGCPlayerPawn_UGC_TakeDamageOverrideEvent] DamageCauser:GetOwner():%s", KismetSystemLibrary.GetObjectName(DamageCauser:GetOwner()))
|
|
local TargetPlayerKey = DamageCauser:GetOwner().PlayerKey
|
|
if TargetPlayerKey then
|
|
local CauserTeamID = UGCPlayerStateSystem.GetTeamID(TargetPlayerKey)
|
|
local SelfTeamID = UGCPlayerStateSystem.GetTeamID(self.PlayerKey)
|
|
DamageAmount = (CauserTeamID == SelfTeamID and GlobalConfigs.GameSetting.FriendlyInjuryRatio * DamageAmount or DamageAmount)
|
|
end
|
|
end
|
|
|
|
-- 掉落伤害
|
|
if DamageType == EDamageType.FallingDamage then
|
|
DamageAmount = GlobalConfigs.GameSetting.bEnableDropDamage and DamageAmount or 0.
|
|
end
|
|
|
|
if DamageType == EDamageType.MeleeDamage then
|
|
DamageAmount = DamageAmount * GlobalConfigs.GameSetting.MeleeDamageScale
|
|
end
|
|
|
|
UGCLogSystem.Log("[UGCPlayerPawn_UGC_TakeDamageOverrideEvent] ModifyDamageAmount:%s", tostring(DamageAmount))
|
|
return DamageAmount
|
|
end
|
|
|
|
---------------------------------------------- ModifyDamage End ----------------------------------------------
|
|
|
|
|
|
-- UGC Event -------------------------------------------------------------------------------------------------------
|
|
-- 这些事件都是官方的回调或者可重写的事件
|
|
|
|
---@field UGC_PlayerDeadEvent:fun(Killer:AController,DamageType:EDamageType)
|
|
---@field UGC_PlayerPickUpEvent:fun()
|
|
---@field UGC_LeavePawnStateEvent:fun(PawnState:EPawnState)
|
|
---@field UGC_EnterPawnStateEvent:fun(PawnState:EPawnState)
|
|
---@field UGC_CloseScopeEvent:fun()
|
|
---@field UGC_OpenScopeEvent:fun()
|
|
---@field UGC_ReloadEndEvent:fun()
|
|
---@field UGC_ReloadStartEvent:fun()
|
|
---@field UGC_WeaponSwitchEvent:fun()
|
|
---@field UGC_WeaponStopFireEvent:fun()
|
|
---@field UGC_WeaponStartFireEvent:fun(isAuto:ESTEWeaponShootType)
|
|
---@field UGC_EquipWeaponEvent:fun(Slot:ESurviveWeaponPropSlot)
|
|
---@field UGC_ChangeCurrentUsingWeaponEvent:fun(UsingWeaponSlot:ESurviveWeaponPropSlot,LastSlot:ESurviveWeaponPropSlot)
|
|
|
|
--- 子弹命中
|
|
---@field UGC_WeaponBulletHitEvent:fun(ShootWeapon:ASTExtraShootWeapon,Bullet:ASTExtraShootWeaponBulletBase,HitInfo:FHitResult)
|
|
function UGCPlayerPawn:UGC_WeaponBulletHitEvent(ShootWeapon, Bullet, HitInfo)
|
|
UGCEventSystem.SendEvent(EventEnum.BulletHitCallBack, self, ShootWeapon, Bullet, HitInfo)
|
|
end
|
|
|
|
|
|
---@field UGC_WeaponShootBulletEvent:fun(ShootWeapon:ASTExtraShootWeapon,Bullet:ASTExtraShootWeaponBulletBase)
|
|
|
|
-- UGC Event End -----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
--- 处理飘字
|
|
function UGCPlayerPawn:UGC_GetDamageNumberConfigIndex(Damage, IsHeadShot, InstigatorController, DamageCauser, DamageType)
|
|
UGCLogSystem.Log("[UGCPlayerPawn_UGC_GetDamageNumberConfigIndex]")
|
|
if InstigatorController == UGCSystemLibrary.GetLocalPlayerController() then
|
|
return 0
|
|
else
|
|
return -1
|
|
end
|
|
|
|
end
|
|
|
|
|
|
--- 播放粒子
|
|
function UGCPlayerPawn:PlayParticle(InParticleType)
|
|
ParticleConfig.AddParticleAttachPlayer(self, InParticleType)
|
|
end
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------------------------------
|
|
----- 获取可获得增量次数的数值
|
|
--function UGCPlayerPawn:GetCanObtainIncreaseCount()
|
|
-- return self.CanObtainIncreaseCount
|
|
--end
|
|
----- 获取当前可选择增量类型的列表
|
|
--function UGCPlayerPawn:GetNowCanSelectIncrease()
|
|
-- return self.NowCanSelectIncrease
|
|
--end
|
|
--
|
|
----- 增加可选增益层数
|
|
--function UGCPlayerPawn:AddCanObtainIncreaseCount()
|
|
-- -- 判断增益是否满了
|
|
-- if self.IncreaseIsFull then return end
|
|
-- if self.CanObtainIncreaseCount > 0 then
|
|
-- self.CanObtainIncreaseCount = self.CanObtainIncreaseCount + 1
|
|
-- else
|
|
-- self.CanObtainIncreaseCount = 1
|
|
-- self:UpdateNowCanSelectIncrease()
|
|
-- end
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:SetCanObtainIncreaseCount(InCanObtainIncreaseCount)
|
|
-- self.CanObtainIncreaseCount = InCanObtainIncreaseCount
|
|
--end
|
|
--
|
|
----- 增加成神进度
|
|
--function UGCPlayerPawn:AddToGodSchedule(AddCount)
|
|
-- if self.ToGodSchedule < GodOfWarConfig.ToGodCondition then
|
|
-- self.ToGodSchedule = self.ToGodSchedule + AddCount
|
|
-- if self:PlayerIsGod() then
|
|
-- local UseBuffRes = BuffSystemAPI.PlayerAddBuff(self, GodOfWarConfig.GodOfWarBuff)
|
|
-- UGCLogSystem.Log("[UGCPlayerPawn_AddToGodSchedule] Finish UseBuffRes:%s", tostring(UseBuffRes))
|
|
-- UGCSendRPCSystem.ActorRPCNotify(nil, self, "PlayerToGodEffect", self.PlayerKey)
|
|
-- end
|
|
-- end
|
|
--end
|
|
--
|
|
----- 获取成神进度
|
|
--function UGCPlayerPawn:GetToGodSchedule()
|
|
-- return self.ToGodSchedule
|
|
--end
|
|
--
|
|
----- 判断玩家是否为战神
|
|
--function UGCPlayerPawn:PlayerIsGod()
|
|
-- return self.ToGodSchedule >= GodOfWarConfig.ToGodCondition
|
|
--end
|
|
--
|
|
----- 玩家选择增益
|
|
--function UGCPlayerPawn:PlayerSelectIncrease(SelectIndex)
|
|
-- if self.CanObtainIncreaseCount > 0 and SelectIndex > 0 and SelectIndex <= GodOfWarConfig.CanSelectIncreaseCount then
|
|
-- -- 给予玩家增幅
|
|
-- self:PlayerAddIncrease(self.NowCanSelectIncrease[SelectIndex])
|
|
-- self.CanObtainIncreaseCount = self.CanObtainIncreaseCount - 1
|
|
-- if self.CanObtainIncreaseCount > 0 then
|
|
-- self:UpdateNowCanSelectIncrease()
|
|
-- else
|
|
-- self.NowCanSelectIncrease = {}
|
|
-- end
|
|
-- end
|
|
--end
|
|
--
|
|
--
|
|
--
|
|
----- 玩家获得增益
|
|
--function UGCPlayerPawn:PlayerAddIncrease(InIncreaseType)
|
|
-- UGCLogSystem.Log("[UGCPlayerPawn_PlayerAddIncrease] InIncreaseType:%s", tostring(InIncreaseType))
|
|
-- if self.OwnedIncrease[InIncreaseType] == nil then
|
|
-- self.OwnedIncrease[InIncreaseType] = 0
|
|
-- end
|
|
-- if #GodOfWarConfig.BuffList[InIncreaseType] > self.OwnedIncrease[InIncreaseType] then
|
|
-- self.OwnedIncrease[InIncreaseType] = self.OwnedIncrease[InIncreaseType] + 1
|
|
-- if self.OwnedIncrease[InIncreaseType] > 1 then
|
|
-- -- 移除上一级增幅
|
|
-- BuffSystemAPI.PlayerRemoveBuffFromBuffAssetType(self, GodOfWarConfig.BuffList[InIncreaseType][self.OwnedIncrease[InIncreaseType] - 1], 1)
|
|
-- end
|
|
-- local UseBuffRes = BuffSystemAPI.PlayerAddBuff(self, GodOfWarConfig.BuffList[InIncreaseType][self.OwnedIncrease[InIncreaseType]])
|
|
-- -- 播放特效
|
|
-- UGCSendRPCSystem.ActorRPCNotify(self.PlayerKey, self, "PlayerAddIncreaseEffect", InIncreaseType)
|
|
-- UGCLogSystem.Log("[UGCPlayerPawn_PlayerAddIncrease] UseBuffRes:%s", tostring(UseBuffRes))
|
|
-- end
|
|
--end
|
|
--
|
|
----- 更新当前可选增益
|
|
--function UGCPlayerPawn:UpdateNowCanSelectIncrease()
|
|
-- UGCLogSystem.Log("[UGCPlayerPawn_UpdateNowCanSelectIncrease]")
|
|
-- local PlayerCanAddIncrease = {}
|
|
-- for i, IncreaseType in pairs(GodOfWarConfig.EIncreaseType) do
|
|
-- if self.OwnedIncrease[IncreaseType] == nil or #GodOfWarConfig.BuffList[IncreaseType] > self.OwnedIncrease[IncreaseType] then
|
|
-- PlayerCanAddIncrease[#PlayerCanAddIncrease + 1] = IncreaseType
|
|
-- end
|
|
-- end
|
|
-- if #PlayerCanAddIncrease > 0 then
|
|
-- table.Shuffle(PlayerCanAddIncrease)
|
|
-- UGCLogSystem.LogTree("[UGCPlayerPawn_UpdateNowCanSelectIncrease] PlayerCanAddIncrease:", PlayerCanAddIncrease)
|
|
-- for i = 0, GodOfWarConfig.CanSelectIncreaseCount - 1 do
|
|
-- self.NowCanSelectIncrease[i + 1] = PlayerCanAddIncrease[(i % #PlayerCanAddIncrease) + 1]
|
|
-- end
|
|
-- UGCLogSystem.LogTree("[UGCPlayerPawn_UpdateNowCanSelectIncrease] NowCanSelectIncrease:", self.NowCanSelectIncrease)
|
|
-- else
|
|
-- -- 已满
|
|
-- self.NowCanSelectIncrease = {}
|
|
-- self.CanObtainIncreaseCount = 0
|
|
-- self.IncreaseIsFull = true
|
|
-- end
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:SetNowCanSelectIncrease(InNowCanSelectIncrease)
|
|
-- self.NowCanSelectIncrease = InNowCanSelectIncrease
|
|
--end
|
|
--
|
|
----- 获取玩家拥有增效的等级
|
|
--function UGCPlayerPawn:GetOwnedIncreaseLevel(InIncreaseType)
|
|
-- return self.OwnedIncrease[InIncreaseType] and self.OwnedIncrease[InIncreaseType] or 0
|
|
--end
|
|
--
|
|
--function UGCPlayerPawn:GetAllOwnedIncreaseLevel()
|
|
-- return self.OwnedIncrease
|
|
--end
|
|
|
|
|
|
-- Effect ------------------
|
|
---玩家获得增效的客户端显示效果
|
|
function UGCPlayerPawn:PlayerAddIncreaseEffect(InIncreaseType)
|
|
ParticleConfig.AddParticleAttachPlayer(self, ParticleConfig.EParticleType.AddBuff)
|
|
end
|
|
--- 玩家成神的客户端显示效果
|
|
function UGCPlayerPawn:PlayerToGodEffect(PlayerKey)
|
|
UGCEventSystem.SendEvent(EventEnum.AddTip, TipConfig.TipType.GodOfWarCome, PlayerKey)
|
|
if UGCSystemLibrary.GetLocalPlayerKey() == PlayerKey then
|
|
ParticleConfig.AddParticleAttachPlayer(self, ParticleConfig.EParticleType.GodOfWarSelf)
|
|
else
|
|
ParticleConfig.AddParticleAttachPlayer(self, ParticleConfig.EParticleType.GodOfWar)
|
|
end
|
|
end
|
|
|
|
--- 客户端玩家Key更新
|
|
function UGCPlayerPawn:UpdatePlayerKey()
|
|
if self.ClientUpdatedPlayerKey == false then
|
|
if self.PlayerKey and self.PlayerKey > 0 then
|
|
self.ClientUpdatedPlayerKey = true
|
|
self:Stroke()
|
|
end
|
|
end
|
|
end
|
|
|
|
--- Client
|
|
--- 描边
|
|
function UGCPlayerPawn:Stroke()
|
|
if GlobalConfigs.GameSetting.EnableStroke then
|
|
UGCLogSystem.Log("[UGCPlayerPawn_Stroke]PlayerKey:%s", tostring(self.PlayerKey))
|
|
if UGCGameSystem.GameState:GetPlayerTeamIDByPlayerKey(self.PlayerKey) ~= UGCGameSystem.GameState:GetPlayerTeamIDByPlayerKey(UGCSystemLibrary.GetLocalPlayerKey()) then
|
|
-- UGCGameSystem.GameState:RegisterPostProcessMgr(self)
|
|
STExtraBlueprintFunctionLibrary.EnablePlayerAvatarOutline(self, true)
|
|
UGCLogSystem.Log("[UGCPlayerPawn_Stroke] EnablePlayerAvatarOutline")
|
|
end
|
|
end
|
|
end
|
|
|
|
--function UGCPlayerPawn:GetAvailableServerRPCs()
|
|
-- return
|
|
--end
|
|
|
|
|
|
return UGCPlayerPawn; |