Compare commits
No commits in common. "f3f4ad0409ad68149e94d62a94796d544b1d6b31" and "e0ba69c694b93b7751970d5f71cdab52aae10495" have entirely different histories.
f3f4ad0409
...
e0ba69c694
BIN
Content/Weapons/FireWand/BP_FireWandWeapon.uasset
(Stored with Git LFS)
BIN
Content/Weapons/FireWand/BP_FireWandWeapon.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Weapons/Knife/BP_KnifeWeapon.uasset
(Stored with Git LFS)
BIN
Content/Weapons/Knife/BP_KnifeWeapon.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Weapons/TestProjectileDataAsset.uasset
(Stored with Git LFS)
BIN
Content/Weapons/TestProjectileDataAsset.uasset
(Stored with Git LFS)
Binary file not shown.
@ -69,14 +69,12 @@ void AProjectile::LoadDataFromDataAsset_Implementation(UProjectileDataAsset* pro
|
||||
ProjectileSpeed = projectileDataAsset->ProjectileSpeed;
|
||||
ProjectileMovement->InitialSpeed = ProjectileSpeed;
|
||||
ProjectileMovement->MaxSpeed = ProjectileSpeed;
|
||||
RemainingDamagableEnemies = projectileDataAsset->DamagableEnemies;
|
||||
}
|
||||
|
||||
void AProjectile::ResetData_Implementation()
|
||||
{
|
||||
ProjectileSpeed = NULL;
|
||||
StaticMeshComponent->SetStaticMesh(nullptr);
|
||||
RemainingDamagableEnemies = 1;
|
||||
}
|
||||
|
||||
void AProjectile::OnProjectileBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||
@ -98,18 +96,13 @@ void AProjectile::OnProjectileBeginOverlap(UPrimitiveComponent* OverlappedCompon
|
||||
AProjectileWeapon* ownerWeapon = Cast<AProjectileWeapon>(GetOwner());
|
||||
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
|
||||
|
||||
RemainingDamagableEnemies--;
|
||||
AGameModeBase* gamemode = UGameplayStatics::GetGameMode(GetWorld());
|
||||
|
||||
if (RemainingDamagableEnemies == 0)
|
||||
if (UKismetSystemLibrary::DoesImplementInterface(gamemode, UPools::StaticClass()))
|
||||
{
|
||||
AGameModeBase* gamemode = UGameplayStatics::GetGameMode(GetWorld());
|
||||
|
||||
if (UKismetSystemLibrary::DoesImplementInterface(gamemode, UPools::StaticClass()))
|
||||
if (AObjectPoolManager* objectPoolManager = IPools::Execute_GetProjectileObjectPoolManager(gamemode))
|
||||
{
|
||||
if (AObjectPoolManager* objectPoolManager = IPools::Execute_GetProjectileObjectPoolManager(gamemode))
|
||||
{
|
||||
objectPoolManager->ReturnObject(this);
|
||||
}
|
||||
objectPoolManager->ReturnObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,6 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UStaticMeshComponent* StaticMeshComponent = nullptr;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int RemainingDamagableEnemies = 1;
|
||||
|
||||
// Sets default values for this actor's properties
|
||||
AProjectile();
|
||||
|
||||
|
@ -16,11 +16,8 @@ class VAMPIRES_API UProjectileDataAsset : public UDataAsset
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere)
|
||||
float ProjectileSpeed = 1000.0f;
|
||||
float ProjectileSpeed = 500.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
TObjectPtr<UStaticMesh> StaticMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
int DamagableEnemies = 1;
|
||||
};
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "vampires/ObjectPoolManager.h"
|
||||
#include "vampires/PlayerCharacter.h"
|
||||
#include "vampires/Projectile.h"
|
||||
#include "vampires/ProjectileDataAsset.h"
|
||||
#include "vampires/Interfaces/Pools.h"
|
||||
|
||||
AKnifeWeapon::AKnifeWeapon()
|
||||
@ -23,46 +22,7 @@ void AKnifeWeapon::BeginPlay()
|
||||
void AKnifeWeapon::FireWeaponAction_Implementation()
|
||||
{
|
||||
Super::FireWeaponAction_Implementation();
|
||||
}
|
||||
|
||||
bool AKnifeWeapon::UpgradeWeapon_Implementation()
|
||||
{
|
||||
if (!Super::UpgradeWeapon_Implementation()) return false;
|
||||
|
||||
switch (CurrentLevel)
|
||||
{
|
||||
case 1:
|
||||
ProjectilesPerActivation++;
|
||||
break;
|
||||
case 2:
|
||||
ProjectilesPerActivation++;
|
||||
Damage += 5.0f;
|
||||
break;
|
||||
case 3:
|
||||
ProjectilesPerActivation++;
|
||||
break;
|
||||
case 4:
|
||||
ProjectileTemplate->DamagableEnemies++;
|
||||
break;
|
||||
case 5:
|
||||
ProjectilesPerActivation++;
|
||||
break;
|
||||
case 6:
|
||||
ProjectilesPerActivation++;
|
||||
Damage += 5.0f;
|
||||
break;
|
||||
case 7:
|
||||
ProjectileTemplate->DamagableEnemies++;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AKnifeWeapon::FireProjectile()
|
||||
{
|
||||
if (UKismetSystemLibrary::DoesImplementInterface(GetOwner(), UInputable::StaticClass()))
|
||||
{
|
||||
if (ProjectileTemplate && OverlappedEnemies.Num() > 0)
|
||||
@ -86,8 +46,6 @@ void AKnifeWeapon::FireProjectile()
|
||||
|
||||
IProjectilable::Execute_SetTargetDirection(projectile, direction);
|
||||
}
|
||||
|
||||
Super::FireProjectile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ UCLASS()
|
||||
class VAMPIRES_API AKnifeWeapon : public AProjectileWeapon
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
public:
|
||||
AKnifeWeapon();
|
||||
|
||||
@ -22,9 +22,4 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void FireWeaponAction_Implementation() override;
|
||||
|
||||
virtual bool UpgradeWeapon_Implementation() override;
|
||||
|
||||
protected:
|
||||
virtual void FireProjectile() override;
|
||||
};
|
||||
|
@ -63,20 +63,3 @@ void AProjectileWeapon::OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp,
|
||||
OverlappedEnemies.Remove(Enemy);
|
||||
}
|
||||
}
|
||||
|
||||
void AProjectileWeapon::FireWeaponAction_Implementation()
|
||||
{
|
||||
Super::FireWeaponAction_Implementation();
|
||||
|
||||
remainingProjectilesToSpawn = ProjectilesPerActivation;
|
||||
GetWorldTimerManager().SetTimer(FireProjectileTimerHandler, this, &AProjectileWeapon::FireProjectile, ProjectileSpawningDelay, true, 0.0f);
|
||||
}
|
||||
|
||||
void AProjectileWeapon::FireProjectile()
|
||||
{
|
||||
remainingProjectilesToSpawn--;
|
||||
if (remainingProjectilesToSpawn == 0)
|
||||
{
|
||||
GetWorldTimerManager().ClearTimer(FireProjectileTimerHandler);
|
||||
}
|
||||
}
|
||||
|
@ -25,20 +25,9 @@ public:
|
||||
UPROPERTY(EditAnywhere, Category = "Weapon Properties")
|
||||
TObjectPtr<UProjectileDataAsset> ProjectileTemplate = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
int ProjectilesPerActivation = 1;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
float ProjectileSpawningDelay = 0.25f;
|
||||
|
||||
protected:
|
||||
TArray<AActor*> OverlappedEnemies = TArray<AActor*>();
|
||||
|
||||
FTimerHandle FireProjectileTimerHandler;
|
||||
|
||||
private:
|
||||
int remainingProjectilesToSpawn = 0;
|
||||
|
||||
public:
|
||||
AProjectileWeapon();
|
||||
|
||||
@ -54,10 +43,4 @@ public:
|
||||
UFUNCTION()
|
||||
void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
|
||||
int32 OtherBodyIndex);
|
||||
|
||||
virtual void FireWeaponAction_Implementation() override;
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
virtual void FireProjectile();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user