Exemplo n.º 1
0
AProjectile::AProjectile(const FObjectInitializer& objectInitializer)
: Super(objectInitializer)
{
	collisionComp = objectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereComp"));
	collisionComp->InitSphereRadius(15.0f);
	collisionComp->OnComponentBeginOverlap.AddDynamic(this, &AProjectile::OnHit);
	collisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	collisionComp->SetCollisionResponseToAllChannels(ECR_Ignore);
	collisionComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
	collisionComp->CanCharacterStepUpOn = ECB_No;
	collisionComp->SetCanEverAffectNavigation(false);

	RootComponent = collisionComp;

	movementComponent = objectInitializer.CreateDefaultSubobject<UProjectileMovementComponent>(this, TEXT("ProjectileComp"));
	movementComponent->UpdatedComponent = collisionComp;
	movementComponent->InitialSpeed = 1000.f;
	movementComponent->MaxSpeed = 1000.f;
	movementComponent->bRotationFollowsVelocity = true;
	movementComponent->bShouldBounce = false;
	movementComponent->HomingAccelerationMagnitude = 50000.f;

	bReplicates = true;
	bReplicateMovement = true;
	bAlwaysRelevant = true;
	PrimaryActorTick.bCanEverTick = true;

	NetUpdateFrequency = 30.f;
}
Exemplo n.º 2
0
AVRProjectProjectile::AVRProjectProjectile() 
{
	// Use a sphere as a simple collision representation
	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(5.0f);
	CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
	CollisionComp->OnComponentHit.AddDynamic(this, &AVRProjectProjectile::OnHit);		// set up a notification for when this component hits something blocking

	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->InitialSpeed = 3000.f;
	ProjectileMovement->MaxSpeed = 3000.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;

	// Die after 3 seconds by default
	InitialLifeSpan = 3.0f;
}
Exemplo n.º 3
0
// Sets default values
AOutsiderProjectile::AOutsiderProjectile()
{
	// Use a sphere as a simple collision representation
	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(10.0f);
	CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
	CollisionComp->OnComponentHit.AddDynamic(this, &AOutsiderProjectile::OnHit);		// set up a notification for when this component hits something blocking																					// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->InitialSpeed = 400.f;
	ProjectileMovement->MaxSpeed = 600.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;
	ProjectileMovement->ProjectileGravityScale = 0;

	ProjectileMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	const ConstructorHelpers::FObjectFinder<UStaticMesh> MeshObj(TEXT("/Engine/BasicShapes/Sphere"));
	ProjectileMesh->SetStaticMesh(MeshObj.Object);
	ProjectileMesh->SetWorldScale3D(FVector(0.1f,0.1f,0.1f));
	ProjectileMesh->AttachParent = CollisionComp;
	// Die after 3 seconds
	InitialLifeSpan = 3.0f;
}
Exemplo n.º 4
0
// Sets default values
AFireDart::AFireDart()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	// Use a sphere as a simple collision representation
	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(5.0f);
	CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
	//CollisionComp->OnComponentHit.AddDynamic(this, &AFireDart::OnHit);		// set up a notification for when this component hits something blocking
	OnActorBeginOverlap.AddDynamic(this, &AFireDart::OnHit);
	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->InitialSpeed = 3000.f;
	ProjectileMovement->MaxSpeed = 3000.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;

	// Die after 3 seconds by default
	InitialLifeSpan = 3.0f;
	SetActorEnableCollision(true);
}
// Sets default values
APacmanGhostCharacter::APacmanGhostCharacter()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	UCapsuleComponent* Capsule = GetCapsuleComponent();
	Capsule->OnComponentHit.AddDynamic(this, &APacmanGhostCharacter::OnHit);
	Capsule->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	Capsule->CanCharacterStepUpOn = ECB_No;
}
Exemplo n.º 6
0
// Sets default values
AZanshinBasicArrow::AZanshinBasicArrow() : Super()
{
	Root = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComponent"));
	ProjectileMovement->UpdatedComponent = Root;
	ProjectileMovement->InitialSpeed = 0.0f;
	ProjectileMovement->MaxSpeed = 6000.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bAutoActivate = false;
	ProjectileMovement->bShouldBounce = false;
	ProjectileMovement->bEditableWhenInherited = true;
	ProjectileMovement->SetNetAddressable();
	ProjectileMovement->SetIsReplicated(true);

	// Use a sphere as a simple collision representation
	TipSphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	TipSphereComponent->InitSphereRadius(2.5f);
	TipSphereComponent->BodyInstance.SetCollisionProfileName("Projectile");
	TipSphereComponent->OnComponentHit.AddDynamic(this, &AZanshinBasicArrow::OnHit);		// set up a notification for when this component hits something blocking
	TipSphereComponent->SetNetAddressable();
	TipSphereComponent->SetIsReplicated(true);

	// Players can't walk on it
	TipSphereComponent->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	TipSphereComponent->CanCharacterStepUpOn = ECB_No;

	AnimationArrow = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("AnimationArrow"));
	AnimationArrow->AttachTo(TipSphereComponent);

	FlyingArrow = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("FlyingArrow"));
	FlyingArrow->AttachTo(TipSphereComponent);

	ArrowAudioComponent = CreateDefaultSubobject<UAudioComponent>(TEXT("SoundComp"));
	ArrowAudioComponent->Sound = ArrowSound;
	ArrowAudioComponent->AttachTo(TipSphereComponent);

	// Set as root component
	RootComponent = TipSphereComponent;
	RootComponent->SetNetAddressable();
	RootComponent->SetIsReplicated(true);

	DisableComponentsSimulatePhysics();

	bSpecialArrow = false;

	KillTypeArrow = ArrowKillType::STANDARD;

	PrimaryActorTick.bCanEverTick = true;
}
Exemplo n.º 7
0
AFireWall::AFireWall(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer), Damage(50.0f)
{
	// Use a sphere as a simple collision representation
	CollisionComp = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, TEXT("BoxComp"));

	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	// Setting up base variables
	InitialLifeSpan = 15.0f;
	PrimaryActorTick.bCanEverTick = true;
}
Exemplo n.º 8
0
// Sets default values
AFournoidBullet::AFournoidBullet()
{
	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	
	// Initialize bullet capsule component.
	BulletSphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	BulletSphereComp->BodyInstance.SetCollisionProfileName("Projectile");
	// Setup bullet hit
	BulletSphereComp->SetNotifyRigidBodyCollision(true);
	BulletSphereComp->OnComponentHit.AddDynamic(this, &AFournoidBullet::OnHit);
	// Player can't walk on it
	BulletSphereComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	BulletSphereComp->CanCharacterStepUpOn = ECB_No;
	RootComponent = BulletSphereComp;
	
	// Create the bullet's static mesh component.
	BulletMeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BulletMesh"));
	BulletMeshComp->AttachParent = BulletSphereComp;
	BulletMeshComp->bCastDynamicShadow = false;
	BulletMeshComp->CastShadow = false;
	BulletMeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
	BulletMeshComp->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
	
	// Use a ProjectileMovementComponent to govern this projectile's movement
	BulletMovementComp = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("BulletMovementComp"));
	BulletMovementComp->UpdatedComponent = BulletSphereComp;
	BulletMovementComp->InitialSpeed = 3000.f;
	BulletMovementComp->MaxSpeed = 3000.f;
	BulletMovementComp->bRotationFollowsVelocity = true;
	BulletMovementComp->bShouldBounce = false;
	
	// Setup a particle system component associated with the bullet.
	BulletParticleComp = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("BulletParticleSystem"));
	BulletParticleComp->AttachParent = BulletSphereComp;
	
	
	bReplicates = true;
	bReplicateMovement = true;
	
	// Die after 3 seconds by default
	InitialLifeSpan = 3.f;
	BulletImpulseStrength = 10.f;
	BulletDamage = 25.f;
}
Exemplo n.º 9
0
// Sets default values
AdeezProjectile::AdeezProjectile()
{
	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	// Use a sphere as a simple collision representation
	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(5.0f);

	CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");

	CollisionComp->OnComponentHit.AddDynamic(this,&AdeezProjectile::OnHit);		// set up a notification for when this component hits something blocking

	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ProjectileMesh"));
	Mesh->AttachToComponent(RootComponent,FAttachmentTransformRules::KeepRelativeTransform);

	EmissiveParamName = TEXT("Emissiveness");
	MaxEmissiveness = 60.f;

	LifetimeParamName = TEXT("Lifetime");
	MaxLifetime = 0.9;
	CurrentLifetime = 0;
	Damage = 0.f;

	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->InitialSpeed = 1.f;
	ProjectileMovement->MaxSpeed = 500000.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = false;
	ProjectileMovement->ProjectileGravityScale = 0.f;

	// Die after 4 seconds by default
	InitialLifeSpan = 4.0f;

	MassMultiplier = 1.f;
};
Exemplo n.º 10
0
AParticleList::AParticleList(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
	// Use a sphere as a simple collision representation
	CollisionComp = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, TEXT("BoxComp"));

	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	//Allow the actor to tick anywhere
	PrimaryActorTick.bCanEverTick = true;
	PrimaryActorTick.bStartWithTickEnabled = true;
	PrimaryActorTick.bAllowTickOnDedicatedServer = true;
	SetActorTickEnabled(true);
}
Exemplo n.º 11
0
ANimModProjectile::ANimModProjectile(const FObjectInitializer& ObjectInitializer) 
	: Super(ObjectInitializer)
{
	// Use a sphere as a simple collision representation
	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(5.0f);
	CollisionComp->AlwaysLoadOnClient = true;
	CollisionComp->AlwaysLoadOnServer = true;
	CollisionComp->bTraceComplexOnMove = true;
	CollisionComp->SetSimulatePhysics(false);
	CollisionComp->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
	CollisionComp->SetCollisionObjectType(COLLISION_PROJECTILE);
	CollisionComp->SetCollisionResponseToAllChannels(ECR_Ignore);
	CollisionComp->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);
	CollisionComp->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Block);
	CollisionComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block);
	/*CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");*/
	//CollisionComp->OnComponentHit.AddDynamic(this, &ANimModProjectile::OnHit);		// set up a notification for when this component hits something blocking

	// Players can't walk on it
	CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
	CollisionComp->CanCharacterStepUpOn = ECB_No;

	// Set as root component
	RootComponent = CollisionComp;

	ParticleComp = ObjectInitializer.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("ParticleComp"));
	ParticleComp->bAutoActivate = false;
	ParticleComp->bAutoDestroy = false;
	ParticleComp->AttachParent = RootComponent;

	// Use a ProjectileMovementComponent to govern this projectile's movement
	MovementComp = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
	MovementComp->UpdatedComponent = CollisionComp;
	MovementComp->bRotationFollowsVelocity = true;
	MovementComp->ProjectileGravityScale = 0.0f;

	RadialForceComp = CreateDefaultSubobject<URadialForceComponent>(TEXT("RadialForceComp"));
	RadialForceComp->AttachParent = RootComponent;
	// Die after 3 seconds by default
	//InitialLifeSpan = 3.0f;
}