49 lines
2.0 KiB
Lua
49 lines
2.0 KiB
Lua
|
---@class BTAttachment_FindExerciseRoomPlayer_C:BTAttachment_LuaBase
|
||
|
---@field Radius float
|
||
|
---@field TargetObject FBlackboardKeySelector
|
||
|
---@field TargetBool FBlackboardKeySelector
|
||
|
--Edit Below--
|
||
|
local BTAttachment_FindExerciseRoomPlayer = {
|
||
|
PawnClass = nil;
|
||
|
}
|
||
|
|
||
|
-- tick function
|
||
|
function BTAttachment_FindExerciseRoomPlayer:ReceiveTickAI(OwnerController, ControlledPawn, DeltaSeconds)
|
||
|
local GameState = UGCGameSystem.GameState
|
||
|
if not UE.IsValid(GameState) or not ControlledPawn or ControlledPawn.TargetPlayerKey == nil or ControlledPawn.TargetPlayerKey < 0 then
|
||
|
BTFunctionLibrary.SetBlackboardValueAsObject(self, self.TargetObject, nil)
|
||
|
BTFunctionLibrary.SetBlackboardValueAsBool(self, self.TargetBool, false)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if ControlledPawn.bIsStun == true then
|
||
|
BTFunctionLibrary.SetBlackboardValueAsObject(self, self.TargetObject, nil)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local TargetPawn = UGCGameSystem.GetPlayerPawnByPlayerKey(ControlledPawn.TargetPlayerKey)
|
||
|
BTFunctionLibrary.SetBlackboardValueAsObject(self, self.TargetObject, TargetPawn)
|
||
|
|
||
|
if TargetPawn ~= nil and UE.IsValid(TargetPawn) and TargetPawn.bIsAlive and TargetPawn.IsInArena == false then
|
||
|
BTFunctionLibrary.SetBlackboardValueAsBool(self, self.TargetBool, true)
|
||
|
else
|
||
|
BTFunctionLibrary.SetBlackboardValueAsBool(self, self.TargetBool, false)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- -- attachment became active
|
||
|
function BTAttachment_FindExerciseRoomPlayer:ReceiveActivationAI(OwnerController, ControlledPawn)
|
||
|
-- UE.Log("[BTAttachment_FindExerciseRoomPlayer] ReceiveActivationAI: ControlledPawn:[%s]", KismetSystemLibrary.GetObjectName(ControlledPawn))
|
||
|
end
|
||
|
|
||
|
-- -- attachment became inactive
|
||
|
-- function BTAttachment_FindExerciseRoomPlayer:ReceiveDeactivationAI(OwnerController, ControlledPawn)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- -- task search enters branch of tree
|
||
|
-- function BTAttachment_FindExerciseRoomPlayer:ReceiveSearchStartAI(OwnerController, ControlledPawn)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
return BTAttachment_FindExerciseRoomPlayer
|