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());
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->GetDamage(), nullptr, ownerController, this);
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
RemainingDamagableEnemies--;

View File

@ -12,7 +12,7 @@
// Sets default values
AWeapon::AWeapon()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// 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;
BoxComponent = CreateDefaultSubobject<UBoxComponent>(TEXT("Box Component"));
@ -64,8 +64,7 @@ bool AWeapon::UpgradeWeapon_Implementation()
}
void AWeapon::OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult)
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (AEnemyCharacter* Enemy = Cast<AEnemyCharacter>(OtherActor))
{
@ -74,7 +73,7 @@ void AWeapon::OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAc
}
void AWeapon::OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
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)
{
return;
}
if (!GEngine->GameViewport) return;
FVector TopLeft, TopLeftDir;
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
// 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;
height *= 266.666;

View File

@ -16,86 +16,78 @@ class VAMPIRES_API AWeapon : public AActor
{
GENERATED_BODY()
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information")
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
FText Name;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
FText Description;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Information")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
TObjectPtr<UTexture2D> Icon;
UPROPERTY(EditDefaultsOnly, Category = "Weapon | Properties")
UPROPERTY(EditDefaultsOnly, Category = "Weapon Properties")
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;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Properties")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
float Damage;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Properties")
bool FollowPlayer = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Upgrades")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties")
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;
UPROPERTY()
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TObjectPtr<UBoxComponent> BoxComponent = nullptr;
TArray<TObjectPtr<AActor>> OverlappedEnemies = TArray<TObjectPtr<AActor>>();
int CurrentLevel = 0;
private:
FTimerHandle WeaponTimerHandle;
public:
// Sets default values for this actor's
// Sets default values for this actor's properties
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:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void ResetWeaponTimer();
public:
UFUNCTION(BlueprintNativeEvent)
void FireWeaponAction();
virtual void FireWeaponAction_Implementation();
UFUNCTION(BlueprintNativeEvent)
bool UpgradeWeapon();
virtual bool UpgradeWeapon_Implementation();
UFUNCTION()
virtual void OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult);
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult);
UFUNCTION()
virtual void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex);
virtual void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex);
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();
AWeapon* weapon = GetWorld()->SpawnActor<AWeapon>(Weapon, SpawnParameters.Owner->GetTransform(), SpawnParameters);
if (weapon->GetFollowPlayer())
if (weapon->FollowPlayer)
{
weapon->AttachToActor(GetOwner(), FAttachmentTransformRules::KeepWorldTransform);
}

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ void ASwarmAgent::OnSwarmAgentBeginOverlap(UPrimitiveComponent* OverlappedCompon
if (AVampireCharacter* character = Cast<AVampireCharacter>(ownerWeapon->GetOwner()))
{
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()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon | Swarm")
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Timeline")
TObjectPtr<UTimelineComponent> TimelineComponent = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Swarm")
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TObjectPtr<UCurveFloat> SwarmCurve;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Swarm")
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float TimelinePlayRate = 1;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Weapon | Swarm")
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<ASwarmAgent> SwarmActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon | Swarm")
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float Distance = 250.0f;
private:

View File

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

View File

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