---1.播放Sequence动画
---@type UGameplayStatics
local GameplayStatics = import'GameplayStatics';
---获取LevelSequenceActor class
local seq = import'LevelSequenceActor'
local arr = GameplayStatics.GetAllActorsOfClass(self,seq,nil)
for k,v in pairs(arr) do
if(v:ActorHasTag("anim"))then
print("GetAllActorsOfClass",k,v)
v.SequencePlayer.OnFinished:Clear()
v.SequencePlayer.OnFinished:Add(
function()
print("动画完成")
end
)
v.SequencePlayer:Play()
end
end
---2.执行ai行为树
local controller = self:GetController()
if(controller == nil)then
print("controller nil")
end
local ai = import "AIBlueprintHelperLibrary"
local aiController = ai.GetAIController(self.controller)
aiController:RunBehaviorTree(self.behaviorTree)
-- aiController:MoveToLocation(self:K2_GetActorLocation() + FVector(0.0, 100.0, 0.0),-0.15,true,true,false,true,nil,true)
(UE4)Sluaunreal使用技巧(随时更新)
最新推荐文章于 2024-04-21 09:59:32 发布