Exemplo n.º 1
0
// Sets default values
AGhost::AGhost() : ActiveModeIndex(0)
{
	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	auto Capsule = GetCapsuleComponent();
	Capsule->SetCollisionObjectType(ECC_GHOST);
	Capsule->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block);
	Capsule->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);
	Capsule->SetCollisionResponseToChannel(ECC_PICKUP, ECollisionResponse::ECR_Ignore);

	PathFollowingComponent = CreateDefaultSubobject<UPacmanPathFollowingComponent>("PathFollowingComponent");

	int32 NumModes = FMath::RandRange(2, 10);
	Modes.SetNum(NumModes);

	for (int32 i = 0; i < NumModes; ++i)
	{
		Modes[i].Duration = FMath::FRandRange(5.f, 20.f);
		Modes[i].GhostState = static_cast<EGhostState>(i % 2);
	}

	// Last state must be chased
	Modes.Last().GhostState = EGhostState::Chase;
	Modes.Last().Duration = 0.f;
}
UCubiquityMeshComponent::UCubiquityMeshComponent(const FObjectInitializer& PCIP)
	: Super(PCIP)
{
	//UE_LOG(CubiquityLog, Log, TEXT("Creating UCubiquityMeshComponent"));
	PrimaryComponentTick.bCanEverTick = false;
	SetMobility(EComponentMobility::Stationary);
	SetCollisionObjectType(ECC_WorldStatic);
}