Update Weapon Pickup Defaults
This commit is contained in:
		
							parent
							
								
									ac9c8981b9
								
							
						
					
					
						commit
						cb969be97c
					
				@ -32,7 +32,9 @@ void AWeaponPickup::BeginPlay()
 | 
				
			|||||||
		WeaponComponent->AttachToComponent(RootComponent, TransformRules);
 | 
							WeaponComponent->AttachToComponent(RootComponent, TransformRules);
 | 
				
			||||||
		WeaponComponent->SetActorRelativeLocation(FVector(0.0f, 0.0f, 5.0f));
 | 
							WeaponComponent->SetActorRelativeLocation(FVector(0.0f, 0.0f, 5.0f));
 | 
				
			||||||
		WeaponComponent->SetActorEnableCollision(false);
 | 
							WeaponComponent->SetActorEnableCollision(false);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		WeaponStartingLocation = WeaponComponent->GetActorLocation();
 | 
							WeaponStartingLocation = WeaponComponent->GetActorLocation();
 | 
				
			||||||
 | 
							WeaponStartingLocation += ((MovementDirection * MovementDistance) / 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &AWeaponPickup::OnOverlapBegin);
 | 
							SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &AWeaponPickup::OnOverlapBegin);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -51,7 +53,7 @@ void AWeaponPickup::Tick(float DeltaTime)
 | 
				
			|||||||
		// Bob weapon up and down
 | 
							// Bob weapon up and down
 | 
				
			||||||
		float Time = GetWorld()->GetRealTimeSeconds();
 | 
							float Time = GetWorld()->GetRealTimeSeconds();
 | 
				
			||||||
		float Sine = FMath::Sin(Time * MovementSpeed);
 | 
							float Sine = FMath::Sin(Time * MovementSpeed);
 | 
				
			||||||
		WeaponComponent->SetActorLocation(WeaponStartingLocation + (MovementDirection * Sine));
 | 
							WeaponComponent->SetActorLocation(WeaponStartingLocation + ((MovementDirection * Sine) * MovementDistance));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,16 +20,19 @@ public:
 | 
				
			|||||||
	TSubclassOf<class AWeapon> Weapon;
 | 
						TSubclassOf<class AWeapon> Weapon;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
						UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
				
			||||||
	FVector MovementDirection = FVector(0.0f, 1.0f, 0.0f);
 | 
						FVector MovementDirection = FVector(0.0f, 0.0f, 1.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
				
			||||||
 | 
						float MovementDistance = 1.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
						UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
				
			||||||
	float MovementSpeed = 1.0f;
 | 
						float MovementSpeed = 1.0f;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
						UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
				
			||||||
	FRotator SpinRotation = FRotator(0, 1, 0);
 | 
						FRotator SpinRotation = FRotator(0.0, 1.0f, 0.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
						UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
 | 
				
			||||||
	float RotationSpeed = 1.0f;
 | 
						float RotationSpeed = 25.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user