Compare commits

..

No commits in common. "a23d1a86d95a925d19d23efe2248df2ab7781bfd" and "274ae9fc27bf82ad0f7075781a1fe68c6cb5f5b2" have entirely different histories.

14 changed files with 87 additions and 96 deletions

Binary file not shown.

BIN
Content/Weapons/Swarm/BP_SwarmAgent.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -110,7 +110,7 @@ void AProjectile::OnProjectileBeginOverlap(UPrimitiveComponent* OverlappedCompon
} }
AProjectileWeapon* ownerWeapon = Cast<AProjectileWeapon>(GetOwner()); AProjectileWeapon* ownerWeapon = Cast<AProjectileWeapon>(GetOwner());
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->GetDamage(), nullptr, ownerController, this); EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
RemainingDamagableEnemies--; RemainingDamagableEnemies--;

View File

@ -64,8 +64,7 @@ bool AWeapon::UpgradeWeapon_Implementation()
} }
void AWeapon::OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, void AWeapon::OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
const FHitResult& SweepResult)
{ {
if (AEnemyCharacter* Enemy = Cast<AEnemyCharacter>(OtherActor)) if (AEnemyCharacter* Enemy = Cast<AEnemyCharacter>(OtherActor))
{ {
@ -82,12 +81,10 @@ void AWeapon::OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* Ot
} }
} }
void AWeapon::ResizeBoxComponent(FViewport* Viewport, const uint32 Unused) void AWeapon::ResizeBoxComponent(FViewport* Viewport, uint32 unused)
{ {
if (!GEngine->GameViewport)
{ if (!GEngine->GameViewport) return;
return;
}
FVector TopLeft, TopLeftDir; FVector TopLeft, TopLeftDir;
FVector TopRight, TopRightDir; FVector TopRight, TopRightDir;
@ -111,7 +108,7 @@ void AWeapon::ResizeBoxComponent(FViewport* Viewport, const uint32 Unused)
// I am using the unused flag to work around a bug where the DeprojectScreenPositionToWorld doesn't match the // I am using the unused flag to work around a bug where the DeprojectScreenPositionToWorld doesn't match the
// values that I am expecting, in that they are way too small, for any other resize event we can skip this nonsense. // values that I am expecting, in that they are way too small, for any other resize event we can skip this nonsense.
if (Unused == -2) if (unused == -2)
{ {
width *= 266.666; width *= 266.666;
height *= 266.666; height *= 266.666;

View File

@ -16,86 +16,78 @@ class VAMPIRES_API AWeapon : public AActor
{ {
GENERATED_BODY() GENERATED_BODY()
protected: public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
FText Name; FText Name;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
FText Description; FText Description;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
TObjectPtr<UTexture2D> Icon; TObjectPtr<UTexture2D> Icon;
UPROPERTY(EditDefaultsOnly, Category = "Weapon | Properties") UPROPERTY(EditDefaultsOnly, Category = "Weapon Properties")
TObjectPtr<USoundBase> WeaponActivatedSoundBase = nullptr; TObjectPtr<USoundBase> WeaponActivatedSoundBase = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Properties") UPROPERTY(EditDefaultsOnly, Category = "Weapon Properties")
TObjectPtr<UPaperSprite> WeaponSprite = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
float WeaponCooldown = 1.0f; float WeaponCooldown = 1.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Properties") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
float Damage; float Damage;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Properties") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
bool FollowPlayer = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Upgrades")
TArray<FText> UpgradeDescriptions; TArray<FText> UpgradeDescriptions;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon | Upgrades") int CurrentLevel = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
bool FollowPlayer = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
int MaxLevel = 0; int MaxLevel = 0;
UPROPERTY() protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TObjectPtr<UBoxComponent> BoxComponent = nullptr; TObjectPtr<UBoxComponent> BoxComponent = nullptr;
TArray<TObjectPtr<AActor>> OverlappedEnemies = TArray<TObjectPtr<AActor>>(); TArray<TObjectPtr<AActor>> OverlappedEnemies = TArray<TObjectPtr<AActor>>();
int CurrentLevel = 0;
private: private:
FTimerHandle WeaponTimerHandle; FTimerHandle WeaponTimerHandle;
public: public:
// Sets default values for this actor's // Sets default values for this actor's properties
AWeapon(); AWeapon();
UFUNCTION(BlueprintNativeEvent)
bool UpgradeWeapon();
virtual bool UpgradeWeapon_Implementation();
FText GetWeaponName() const { return Name; }
FText GetDescription() const { return Description; }
TObjectPtr<UTexture2D> GetIcon() const { return Icon; }
float GetDamage() const { return Damage; }
bool GetFollowPlayer() const { return FollowPlayer; }
TArray<FText> GetUpgradeDescriptions() const { return UpgradeDescriptions; }
int GetWeaponLevel() const { return CurrentLevel; }
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;
void ResetWeaponTimer(); void ResetWeaponTimer();
public:
UFUNCTION(BlueprintNativeEvent) UFUNCTION(BlueprintNativeEvent)
void FireWeaponAction(); void FireWeaponAction();
virtual void FireWeaponAction_Implementation(); virtual void FireWeaponAction_Implementation();
UFUNCTION(BlueprintNativeEvent)
bool UpgradeWeapon();
virtual bool UpgradeWeapon_Implementation();
UFUNCTION() UFUNCTION()
virtual void OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, virtual void OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult); const FHitResult& SweepResult);
UFUNCTION() UFUNCTION()
virtual void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, virtual void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex); int32 OtherBodyIndex);
private: private:
void ResizeBoxComponent(FViewport* Viewport, uint32 Unused);
void ResizeBoxComponent(FViewport* Viewport, uint32 unused);
}; };

View File

@ -42,7 +42,7 @@ void UWeaponInventoryComponent::AddWeaponToInventory(TSubclassOf<AWeapon> Weapon
SpawnParameters.Owner = GetOwner(); SpawnParameters.Owner = GetOwner();
AWeapon* weapon = GetWorld()->SpawnActor<AWeapon>(Weapon, SpawnParameters.Owner->GetTransform(), SpawnParameters); AWeapon* weapon = GetWorld()->SpawnActor<AWeapon>(Weapon, SpawnParameters.Owner->GetTransform(), SpawnParameters);
if (weapon->GetFollowPlayer()) if (weapon->FollowPlayer)
{ {
weapon->AttachToActor(GetOwner(), FAttachmentTransformRules::KeepWorldTransform); weapon->AttachToActor(GetOwner(), FAttachmentTransformRules::KeepWorldTransform);
} }

View File

@ -28,12 +28,12 @@ class VAMPIRES_API AGarlicWeapon : public AWeapon
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "Weapon | Garlic") UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USphereComponent> SphereComponent; TObjectPtr<USphereComponent> SphereComponent;
TArray<FOverlappedEnemy> GarlicOverlappedEnemies; TArray<FOverlappedEnemy> GarlicOverlappedEnemies;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "Weapon | Garlic") UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UStaticMeshComponent> VisualEffectMeshComponent; TObjectPtr<UStaticMeshComponent> VisualEffectMeshComponent;
private: private:

View File

@ -18,13 +18,13 @@ class VAMPIRES_API ALightningRingWeapon : public AWeapon
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Lightning Ring") UPROPERTY(EditAnywhere, BlueprintReadWrite)
int LightningBolts = 1; int LightningBolts = 1;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Lightning Ring") UPROPERTY(EditAnywhere, BlueprintReadWrite)
float LightingBoltRadius = 200.0f; float LightingBoltRadius = 200.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Lightning Ring") UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UNiagaraSystem> LightningEffectSystem; TObjectPtr<UNiagaraSystem> LightningEffectSystem;
public: public:

View File

@ -18,13 +18,13 @@ class VAMPIRES_API AProjectileWeapon : public AWeapon
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, Category = "Weapon | Projectiles") UPROPERTY(EditAnywhere, Category = "Weapon Properties")
TObjectPtr<UProjectileDataAsset> ProjectileTemplate = nullptr; TObjectPtr<UProjectileDataAsset> ProjectileTemplate = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Projectiles") UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int ProjectilesPerActivation = 1; int ProjectilesPerActivation = 1;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Projectiles") UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float ProjectileSpawningDelay = 0.25f; float ProjectileSpawningDelay = 0.25f;
protected: protected:

View File

@ -52,7 +52,7 @@ void ASwarmAgent::OnSwarmAgentBeginOverlap(UPrimitiveComponent* OverlappedCompon
if (AVampireCharacter* character = Cast<AVampireCharacter>(ownerWeapon->GetOwner())) if (AVampireCharacter* character = Cast<AVampireCharacter>(ownerWeapon->GetOwner()))
{ {
AController* ownerController = character->GetController(); AController* ownerController = character->GetController();
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->GetDamage(), nullptr, ownerController, this); EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
} }
} }
} }

View File

@ -15,19 +15,19 @@ class VAMPIRES_API ASwarmWeapon : public AWeapon
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon | Swarm") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Timeline")
TObjectPtr<UTimelineComponent> TimelineComponent = nullptr; TObjectPtr<UTimelineComponent> TimelineComponent = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Swarm") UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TObjectPtr<UCurveFloat> SwarmCurve; TObjectPtr<UCurveFloat> SwarmCurve;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Swarm") UPROPERTY(EditAnywhere, BlueprintReadWrite)
float TimelinePlayRate = 1; float TimelinePlayRate = 1;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Swarm") UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<ASwarmAgent> SwarmActor; TSubclassOf<ASwarmAgent> SwarmActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Swarm") UPROPERTY(EditAnywhere, BlueprintReadWrite)
float Distance = 250.0f; float Distance = 250.0f;
private: private:

View File

@ -43,7 +43,7 @@ void ULevelUpWidget::NativeConstruct()
TArray<UUpgradeButtonDataObject*> upgradeItems; TArray<UUpgradeButtonDataObject*> upgradeItems;
for (AWeapon* weapon : Inventory) for (AWeapon* weapon : Inventory)
{ {
if (weapon->GetWeaponLevel() < weapon->GetUpgradeDescriptions().Num()) if (weapon->CurrentLevel < weapon->UpgradeDescriptions.Num())
{ {
UUpgradeButtonDataObject* Temp = NewObject<UUpgradeButtonDataObject>(this); UUpgradeButtonDataObject* Temp = NewObject<UUpgradeButtonDataObject>(this);
Temp->SetData(weapon, this); Temp->SetData(weapon, this);

View File

@ -7,22 +7,23 @@
void UStarterWeaponButtonDataObject::SetData(AWeapon* Weapon, UUserWidget* parent) void UStarterWeaponButtonDataObject::SetData(AWeapon* Weapon, UUserWidget* parent)
{ {
WeaponName = Weapon->GetWeaponName(); WeaponName = Weapon->Name;
WeaponIcon = Weapon->GetIcon(); Description = Weapon->UpgradeDescriptions[Weapon->CurrentLevel];
WeaponIcon = Weapon->Icon;
WeaponInstance = Weapon; WeaponInstance = Weapon;
Parent = parent; Parent = parent;
if (Weapon->GetUpgradeDescriptions().Num() > Weapon->GetWeaponLevel())
{
Description = Weapon->GetUpgradeDescriptions()[Weapon->GetWeaponLevel()];
}
} }
void UStarterWeaponButtonDataObject::SetData(TSubclassOf<AWeapon> Weapon, UUserWidget* parent) void UStarterWeaponButtonDataObject::SetData(TSubclassOf<AWeapon> Weapon, UUserWidget* parent)
{ {
if (AWeapon* tempWeapon = NewObject<AWeapon>(this, Weapon)) AWeapon* temp = NewObject<AWeapon>(this, Weapon);
if (temp)
{ {
SetData(tempWeapon, parent); WeaponName = temp->Name;
Description = temp->Description;
WeaponIcon = temp->Icon;
WeaponTemplate = Weapon;
Parent = parent;
} }
} }

View File

@ -7,22 +7,23 @@
void UUpgradeButtonDataObject::SetData(AWeapon* Weapon, UUserWidget* parent) void UUpgradeButtonDataObject::SetData(AWeapon* Weapon, UUserWidget* parent)
{ {
WeaponName = Weapon->GetWeaponName(); WeaponName = Weapon->Name;
WeaponIcon = Weapon->GetIcon(); Description = Weapon->UpgradeDescriptions[Weapon->CurrentLevel];
WeaponIcon = Weapon->Icon;
WeaponInstance = Weapon; WeaponInstance = Weapon;
Parent = parent; Parent = parent;
if (Weapon->GetUpgradeDescriptions().Num() > Weapon->GetWeaponLevel())
{
Description = Weapon->GetUpgradeDescriptions()[Weapon->GetWeaponLevel()];
}
} }
void UUpgradeButtonDataObject::SetData(TSubclassOf<AWeapon> Weapon, UUserWidget* parent) void UUpgradeButtonDataObject::SetData(TSubclassOf<AWeapon> Weapon, UUserWidget* parent)
{ {
if (AWeapon* tempWeapon = NewObject<AWeapon>(this, Weapon)) AWeapon* temp = NewObject<AWeapon>(this, Weapon);
if (temp)
{ {
SetData(tempWeapon, parent); WeaponName = temp->Name;
Description = temp->Description;
WeaponIcon = temp->Icon;
WeaponTemplate = Weapon;
Parent = parent;
} }
} }