Ejemplo n.º 1
0
AMagnetTile::AMagnetTile() : ATile()
{
	PrimaryActorTick.bCanEverTick = true;

	ConstructorHelpers::FObjectFinder<UStaticMesh> mesh( *FName( "/Game/Models/Magnet" ).ToString() );
	TileMesh->SetStaticMesh( mesh.Object );
	TileMesh->SetMobility( EComponentMobility::Static );

	BoxCollision->SetBoxExtent( FVector( 40.0f ) );

	ConstructorHelpers::FObjectFinder<UParticleSystem> particle( *FName( "/Game/Particles/P_Magnet" ).ToString() );
	magnetParticle = CreateDefaultSubobject<UParticleSystemComponent>( TEXT( "Magnet particle" ) );
	magnetParticle->SetTemplate( particle.Object );
	magnetParticle->AttachTo( GetRootComponent() );
	magnetParticle->SetVisibility( false );

	auto pc = Cast<UPrimitiveComponent>( RootComponent );
	pc->SetWorldScale3D( FVector( 1.0f , 1.0f , 1.0f ) );
	delegate.BindUFunction( this , TEXT( "OnBeginHit" ) );
	BoxCollision->OnComponentHit.Add( delegate );

	ConstructorHelpers::FObjectFinder<USoundWave> magnetSoundFile( TEXT( "/Game/Sound/S_MagnetLoop" ) );
	magnetSound = CreateDefaultSubobject<UAudioComponent>( TEXT( "Magnet Sound" ) );
	magnetSound->SetSound( magnetSoundFile.Object );
	magnetSound->bAutoActivate = false;
	magnetSound->AttachTo( BoxCollision );
}
Ejemplo n.º 2
0
UStaticMeshComponent* AGraph::makeVertexMeshForVertex(int32 v)
{
	auto name = FString("vertex").Append(FString::FromInt(v));
	auto vertex = NewObject<UStaticMeshComponent>(this, *name);
	vertex->AttachTo(RootComponent);

	vertex->SetStaticMesh(vertexStaticMesh);
	vertex->SetWorldScale3D(FVector(40.0f, 40.0f, 1.0f));
	vertex->SetWorldLocation(mark[v]->GetActorLocation());

	return vertex;
}
void AIWeapon::FlashEmittHandler()
{
	if (FlashParticleSystemRaw)
	{		
		auto Scale = ParticleSystemComponent->RelativeScale3D;
		auto Rotor = ParticleSystemComponent->RelativeRotation;					
		
		auto _ParticleSystemComponent = UGameplayStatics::SpawnEmitterAttached(FlashParticleSystemRaw,
			RootComponent, NAME_None, ArrowComponent->RelativeLocation, Rotor,
			EAttachLocation::KeepRelativeOffset, true);	

		if (_ParticleSystemComponent)
		{
			_ParticleSystemComponent->SetWorldScale3D(Scale);
			_ParticleSystemComponent->SetWorldRotation(Rotor);
		}			
	}	
}