UGCProjects/GZJ/Script/SimpleSkill/Selector/SimpleSkillSelector.lua
2025-01-08 22:46:12 +08:00

63 lines
2.2 KiB
Lua

-- 技能目标选取器,找到要释放的对象
local SimpleSkillSelector = LuaClass("SimpleSkillSelector")
SimpleSkillSelector.CasterPawn = nil
SimpleSkillSelector.TargetPawns = {}
SimpleSkillSelector.ForwardOffset = 0
SimpleSkillSelector.Param_Float = 0
SimpleSkillSelector.Param_Vector = {X = 0, Y = 0, Z = 0}
function SimpleSkillSelector:ctor()
end
function SimpleSkillSelector:InitSelectorFromData(SelectorData, CasterPawn)
self.CasterPawn = CasterPawn
self.LimitNum = SelectorData.LimitNum
self.ForwardOffset = SelectorData.ForwardOffset
self.Param_Float = SelectorData.Param_Float
self.Param_Vector = SelectorData.Param_Vector
end
function SimpleSkillSelector:GetIgnoredActors()
local ActorsToIgnore = {}
table.insert(ActorsToIgnore, self.CasterPawn)
if self.CasterPawn.IsInArena then
--如果在场内,则忽略所有练功房的怪物
local AllHangUpRoomSpawners = UGCGameSystem.GameState:GetAllHangUpRoomSpawners()
for _, HangUpRoomSpawner in pairs(AllHangUpRoomSpawners) do
for _, SpawnedMonster in pairs(HangUpRoomSpawner.SpawnedMonsters) do
if SpawnedMonster ~= nil and UE.IsValid(SpawnedMonster) and UGCSimpleCharacterSystem.GetHealth(SpawnedMonster) > 0 then
table.insert(ActorsToIgnore, SpawnedMonster)
end
end
end
else
--如果在练功房,则忽略场内进攻怪
local AttackWaveSpawner = UGCGameSystem.GameState:GetAttackWaveSpawner()
if AttackWaveSpawner then
for _, SpawnedMonster in pairs(AttackWaveSpawner.SpawnedMonsters) do
if SpawnedMonster ~= nil and UE.IsValid(SpawnedMonster) and UGCSimpleCharacterSystem.GetHealth(SpawnedMonster) > 0 then
table.insert(ActorsToIgnore, SpawnedMonster)
end
end
end
end
return ActorsToIgnore
end
--- 子类实现
function SimpleSkillSelector:ActivateSelector()
UE.Log("[SimpleSkillSelector] activated")
end
function SimpleSkillSelector:GetTargetPawns()
self.TargetPawns = {}
self:ActivateSelector()
return self.TargetPawns
end
return SimpleSkillSelector;