当前位置: 首页>>代码示例>>C++>>正文


C++ AActor::ActorHasTag方法代码示例

本文整理汇总了C++中AActor::ActorHasTag方法的典型用法代码示例。如果您正苦于以下问题:C++ AActor::ActorHasTag方法的具体用法?C++ AActor::ActorHasTag怎么用?C++ AActor::ActorHasTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AActor的用法示例。


在下文中一共展示了AActor::ActorHasTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAllActorsDrawDistance

void UCarlaSettingsDelegate::SetAllActorsDrawDistance(UWorld* world, const float max_draw_distance) const
{
  ///@TODO: use semantics to grab all actors by type (vehicles,ground,people,props) and set different distances configured in the global properties
  if(!world||!IsValid(world)||world->IsPendingKill()) return;
  AsyncTask(ENamedThreads::GameThread, [=](){
    if(!world||!IsValid(world)||world->IsPendingKill()) return;
    TArray<AActor*> actors;
    #define _MAX_SCALE_SIZE 50.0f
    //set the lower quality - max draw distance
    UGameplayStatics::GetAllActorsOfClass(world, AActor::StaticClass(),actors);
    for(int32 i=0; i<actors.Num(); i++)
    {
      AActor* actor = actors[i];
      if(!IsValid(actor) || actor->IsPendingKill() || 
        actor->IsA<AInstancedFoliageActor>() || //foliage culling is controlled per instance
        actor->IsA<ALandscape>() || //dont touch landscapes nor roads
        actor->ActorHasTag(UCarlaSettings::CARLA_ROAD_TAG) ||
        actor->ActorHasTag(UCarlaSettings::CARLA_SKY_TAG)
      ){
        continue;
      }
      SetActorComponentsDrawDistance(actor, max_draw_distance);
    }
  });
}
开发者ID:cyy1991,项目名称:carla,代码行数:25,代码来源:CarlaSettingsDelegate.cpp

示例2: PyErr_Format

PyObject *py_ue_actor_has_tag(ue_PyUObject * self, PyObject * args) {

	ue_py_check(self);

	char *tag;
	if (!PyArg_ParseTuple(args, "s:actor_has_tag", &tag)) {
		return NULL;
	}

	if (!self->ue_object->IsA<AActor>()) {
		return PyErr_Format(PyExc_Exception, "uobject is not an AActor");
	}

	AActor *actor = (AActor *)self->ue_object;

	if (actor->ActorHasTag(FName(UTF8_TO_TCHAR(tag)))) {
		Py_INCREF(Py_True);
		return Py_True;
	}

	Py_INCREF(Py_False);
	return Py_False;


}
开发者ID:ckyun777,项目名称:UnrealEnginePython,代码行数:25,代码来源:UEPyActor.cpp

示例3: BeginPlay

// Called when the game starts or when spawned
void ATeleportLR::BeginPlay()
{
	Super::BeginPlay();
	
	//Find player
	for (TActorIterator<AActor> It(GetWorld()); It; ++It)
	{
		AActor* Actor = *It;
		if (Actor->ActorHasTag(FName(TEXT("player"))))
		{
			player = (AUfo*)Actor;
		}
	}
}
开发者ID:pfjarschel,项目名称:PacUFO,代码行数:15,代码来源:TeleportLR.cpp

示例4: CheckLoS

void AAgent::CheckLoS()
{
	AAgentController* Controller = Cast<AAgentController>(GetController());
	if (Controller != NULL)
	{
		// Get the location of the agent
		FVector AgentLocation = GetActorLocation();
		// Get the direction the agent is facing
		FVector Direction = GetActorForwardVector();
		// Default trace params
		FCollisionQueryParams TraceParams(TEXT("LineOfSight_Trace"), false, this);
		TraceParams.bTraceAsyncScene = true;

		//=====Draw line trace from agent to player=====//
		FHitResult Hit(ForceInit);
		UWorld* World = GetWorld();

		World->LineTraceSingleByChannel(Hit, AgentLocation + Direction, Controller->GetFocalPoint(), ECollisionChannel::ECC_Visibility, TraceParams, FCollisionResponseParams::DefaultResponseParam);
		//DrawDebugLine(World, AgentLocation + Direction, Controller->GetFocalPoint(), FColor::Yellow, false, -1, 0, 2.0f);
		//==============================================//

		AActor* HitActor = Hit.GetActor();
		if (HitActor != NULL && HitActor->ActorHasTag("Player"))
		{
		}
		/* Otherwise we can assume the actor intersecting the line trace is blocking the line of sight
		from the agent to the player */
		else if (HitActor != NULL)
		{
			/* The focal point is currently on the player actor. Set the PlayerLocation blackboard key
			to the location of this focal point, so that when the agent moves into the Search behaviour
			it will move to the actual location of the player when the agent lost LoS as opposed to the last
			location it sensed the player at.
			*/
			Controller->SetPlayerLocation(Controller->GetFocalPoint());
			// LoS to player is blocked
			bPlayerSeen = false;
			// Reset the player has seen blackboard key so that the Agent can begin searching.
			Controller->SetPlayerFound(bPlayerSeen);
			// Clear the focus on the player
			Controller->ClearFocus(EAIFocusPriority::Gameplay);
			bCanSearch = true;
			Controller->SetCanSearch(bCanSearch);
			// Stop firing if still firing
			if (isFiring)
				StopFiring();
		}
	}
}
开发者ID:ChristopherMurray194,项目名称:Final_Project,代码行数:49,代码来源:Agent.cpp

示例5: BeginPlay

// Called when the game starts or when spawned
void AEnemy::BeginPlay()
{
	Super::BeginPlay();

	//Set Random Material
	int randMat = FMath::RandRange(0, enemyMaterials.Num() - 1);
	StaticMesh->SetMaterial(0, enemyMaterials[randMat]);
	
	//Get reference to gamestate
	gameState = GetWorld() != NULL ? GetWorld()->GetGameState<APacGameState>() : NULL;
	
	//Find player
	for (TActorIterator<AActor> It(GetWorld()); It; ++It)
	{
		AActor* Actor = *It;
		if (Actor->ActorHasTag(FName(TEXT("player"))))
		{
			player = (AUfo*)Actor;
		}
	}

	ufoVelocity = FVector(0.0f, 1.0f, 0.0f)*velMultiplier;
	GetForward();
}
开发者ID:pfjarschel,项目名称:PacUFO,代码行数:25,代码来源:Enemy.cpp


注:本文中的AActor::ActorHasTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。