// Called when the game starts or when spawnedvoidABP_SDK_TrafficCars::BeginPlay(){Super::BeginPlay();// 在UpdateTime秒后 每两秒调用函数RepeatingFunction,循环调用if(IsValid(MemberTimerHandle)){// 注册定时任务事件 执行AnalysisInfo方法GetWorldTimerManager().SetTimer(MemberTimerHandle,this,&ABP_SDK_TrafficCars::AnalysisInfo, UpdateTime,true,
UpdateTime);}}
/**
* Sets a timer to call the given native function at a set interval. If a timer is already set
* for this handle, it will replace the current timer.
*
* @param InOutHandle If the passed-in handle refers to an existing timer, it will be cleared before the new timer is added. A new handle to the new timer is returned in either case.
* @param InObj Object to call the timer function on.
* @param InTimerMethod Method to call when timer fires.
* @param InRate The amount of time (in seconds) between set and firing. If <= 0.f, clears existing timers.
* @param InbLoop true to keep firing at Rate intervals, false to fire only once.
* @param InFirstDelay The time (in seconds) for the first iteration of a looping timer. If < 0.f InRate will be used.
*/template<classUserClass>
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle, UserClass* InObj,typenameFTimerDelegate::TMethodPtr< UserClass > InTimerMethod,float InRate,bool InbLoop =false,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(FTimerDelegate::CreateUObject(InObj, InTimerMethod)), InRate, InbLoop, InFirstDelay);template<classUserClass>
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle, UserClass* InObj,typenameFTimerDelegate::TConstMethodPtr< UserClass > InTimerMethod,float InRate,bool InbLoop =false,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(FTimerDelegate::CreateUObject(InObj, InTimerMethod)), InRate, InbLoop, InFirstDelay);}/** Version that takes any generic delegate. */
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle, FTimerDelegate const& InDelegate,float InRate,bool InbLoop,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(InDelegate), InRate, InbLoop, InFirstDelay);}/** Version that takes a dynamic delegate (e.g. for UFunctions). */
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle, FTimerDynamicDelegate const& InDynDelegate,float InRate,bool InbLoop,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(InDynDelegate), InRate, InbLoop, InFirstDelay);}/*** Version that doesn't take a delegate */
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle,float InRate,bool InbLoop,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(), InRate, InbLoop, InFirstDelay);}/** Version that takes a TFunction */
FORCEINLINE voidSetTimer(FTimerHandle& InOutHandle, TFunction<void(void)>&& Callback,float InRate,bool InbLoop,float InFirstDelay =-1.f){InternalSetTimer(InOutHandle,FTimerUnifiedDelegate(MoveTemp(Callback)), InRate, InbLoop, InFirstDelay);}}