示例#1
0
bool UPawnAction::Activate()
{
	bool bResult = false; 

	UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Activating at priority %s! First start? %s Paused? %s")
		, *GetName()
		, *GetPriorityName()
		, HasBeenStarted() ? TEXT("NO") : TEXT("YES")
		, IsPaused() ? TEXT("YES") : TEXT("NO"));

	if (HasBeenStarted() && IsPaused())
	{
		bResult = Resume();
	}
	else 
	{
		bResult = Start();
		if (bResult == false)
		{
			UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Failed to start.")
				, *GetName());
			bFailedToStart = true;
			SetFinishResult(EPawnActionResult::Failed);
			SendEvent(EPawnActionEventType::FailedToStart);
		}
	}

	return bResult;
}
示例#2
0
	void SimpleThread::Start() {
		DCHECK(!HasBeenStarted()) << "Tried to Start a thread multiple times.";
		bool success = PlatformThread::Create(options_.stack_size(), this, &thread_);
		DCHECK(success);
		base::ThreadRestrictions::ScopedAllowWait allow_wait;
		event_.Wait();  // Wait for the thread to complete initialization.
	}
bool UPawnAction_BlueprintBase::Start()
{
	const bool bHasBeenEverStarted = HasBeenStarted();
	const bool bSuperResult = Super::Start();

	if (bHasBeenEverStarted == false && bSuperResult == true)
	{
		ActionStart(GetPawn());
	}

	return bSuperResult;
}
示例#4
0
	void SimpleThread::Join() {
		DCHECK(HasBeenStarted()) << "Tried to Join a never-started thread.";
		DCHECK(!HasBeenJoined()) << "Tried to Join a thread multiple times.";
		PlatformThread::Join(thread_);
		joined_ = true;
	}
示例#5
0
	SimpleThread::~SimpleThread() {
		DCHECK(HasBeenStarted()) << "SimpleThread was never started.";
		DCHECK(HasBeenJoined()) << "SimpleThread destroyed without being Join()ed.";
	}