Compare commits
2 Commits
78ebf0624f
...
488387767b
Author | SHA1 | Date | |
---|---|---|---|
488387767b | |||
43dad6b126 |
BIN
Content/Weapons/MagicWand/BP_MagicWandWeapon.uasset
(Stored with Git LFS)
BIN
Content/Weapons/MagicWand/BP_MagicWandWeapon.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.
@ -23,33 +23,6 @@ void AFireWandWeapon::BeginPlay()
|
|||||||
void AFireWandWeapon::FireWeaponAction_Implementation()
|
void AFireWandWeapon::FireWeaponAction_Implementation()
|
||||||
{
|
{
|
||||||
Super::FireWeaponAction_Implementation();
|
Super::FireWeaponAction_Implementation();
|
||||||
|
|
||||||
if (ProjectileTemplate && OverlappedEnemies.Num() > 0)
|
|
||||||
{
|
|
||||||
AGameModeBase* gamemode = UGameplayStatics::GetGameMode(GetWorld());
|
|
||||||
|
|
||||||
if (UKismetSystemLibrary::DoesImplementInterface(gamemode, UPools::StaticClass()))
|
|
||||||
{
|
|
||||||
if (AObjectPoolManager* objectPoolManager = IPools::Execute_GetProjectileObjectPoolManager(gamemode))
|
|
||||||
{
|
|
||||||
AActor* projectile = objectPoolManager->GetObject();
|
|
||||||
|
|
||||||
if (UKismetSystemLibrary::DoesImplementInterface(projectile, UProjectilable::StaticClass()))
|
|
||||||
{
|
|
||||||
IProjectilable::Execute_LoadDataFromDataAsset(projectile, ProjectileTemplate);
|
|
||||||
projectile->SetOwner(this);
|
|
||||||
|
|
||||||
AActor* target = OverlappedEnemies[FMath::RandRange(0, OverlappedEnemies.Num() - 1)];
|
|
||||||
FVector direction = UKismetMathLibrary::GetDirectionUnitVector(
|
|
||||||
GetActorLocation(), target->GetActorLocation());
|
|
||||||
direction.Z = 0.0;
|
|
||||||
direction.Normalize();
|
|
||||||
|
|
||||||
IProjectilable::Execute_SetTargetDirection(projectile, direction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AFireWandWeapon::UpgradeWeapon_Implementation()
|
bool AFireWandWeapon::UpgradeWeapon_Implementation()
|
||||||
@ -89,3 +62,35 @@ bool AFireWandWeapon::UpgradeWeapon_Implementation()
|
|||||||
ResetWeaponTimer();
|
ResetWeaponTimer();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AFireWandWeapon::FireProjectile()
|
||||||
|
{
|
||||||
|
if (ProjectileTemplate && OverlappedEnemies.Num() > 0)
|
||||||
|
{
|
||||||
|
AGameModeBase* gamemode = UGameplayStatics::GetGameMode(GetWorld());
|
||||||
|
|
||||||
|
if (UKismetSystemLibrary::DoesImplementInterface(gamemode, UPools::StaticClass()))
|
||||||
|
{
|
||||||
|
if (AObjectPoolManager* objectPoolManager = IPools::Execute_GetProjectileObjectPoolManager(gamemode))
|
||||||
|
{
|
||||||
|
AActor* projectile = objectPoolManager->GetObject();
|
||||||
|
|
||||||
|
if (UKismetSystemLibrary::DoesImplementInterface(projectile, UProjectilable::StaticClass()))
|
||||||
|
{
|
||||||
|
IProjectilable::Execute_LoadDataFromDataAsset(projectile, ProjectileTemplate);
|
||||||
|
projectile->SetOwner(this);
|
||||||
|
|
||||||
|
AActor* target = OverlappedEnemies[FMath::RandRange(0, OverlappedEnemies.Num() - 1)];
|
||||||
|
FVector direction = UKismetMathLibrary::GetDirectionUnitVector(
|
||||||
|
GetActorLocation(), target->GetActorLocation());
|
||||||
|
direction.Z = 0.0;
|
||||||
|
direction.Normalize();
|
||||||
|
|
||||||
|
IProjectilable::Execute_SetTargetDirection(projectile, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
Super::FireProjectile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -24,4 +24,7 @@ public:
|
|||||||
virtual void FireWeaponAction_Implementation() override;
|
virtual void FireWeaponAction_Implementation() override;
|
||||||
|
|
||||||
virtual bool UpgradeWeapon_Implementation() override;
|
virtual bool UpgradeWeapon_Implementation() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void FireProjectile() override;
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "Kismet/KismetMathLibrary.h"
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
#include "vampires/ObjectPoolManager.h"
|
#include "vampires/ObjectPoolManager.h"
|
||||||
#include "vampires/Projectile.h"
|
#include "vampires/Projectile.h"
|
||||||
|
#include "vampires/ProjectileDataAsset.h"
|
||||||
#include "vampires/Interfaces/Pools.h"
|
#include "vampires/Interfaces/Pools.h"
|
||||||
|
|
||||||
AMagicWandWeapon::AMagicWandWeapon()
|
AMagicWandWeapon::AMagicWandWeapon()
|
||||||
@ -22,7 +23,46 @@ void AMagicWandWeapon::BeginPlay()
|
|||||||
void AMagicWandWeapon::FireWeaponAction_Implementation()
|
void AMagicWandWeapon::FireWeaponAction_Implementation()
|
||||||
{
|
{
|
||||||
Super::FireWeaponAction_Implementation();
|
Super::FireWeaponAction_Implementation();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AMagicWandWeapon::UpgradeWeapon_Implementation()
|
||||||
|
{
|
||||||
|
if (!Super::UpgradeWeapon_Implementation()) return false;
|
||||||
|
|
||||||
|
switch (CurrentLevel)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
ProjectilesPerActivation++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
WeaponCooldown -= 0.2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ProjectilesPerActivation++;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Damage += 10;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ProjectilesPerActivation++;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
ProjectileTemplate->DamagableEnemies++;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
Damage += 10;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResetWeaponTimer();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AMagicWandWeapon::FireProjectile()
|
||||||
|
{
|
||||||
if (ProjectileTemplate && OverlappedEnemies.Num() > 0)
|
if (ProjectileTemplate && OverlappedEnemies.Num() > 0)
|
||||||
{
|
{
|
||||||
float distance = 0.0f;
|
float distance = 0.0f;
|
||||||
@ -50,6 +90,8 @@ void AMagicWandWeapon::FireWeaponAction_Implementation()
|
|||||||
|
|
||||||
IProjectilable::Execute_SetTargetDirection(projectile, direction);
|
IProjectilable::Execute_SetTargetDirection(projectile, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Super::FireProjectile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,9 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void FireWeaponAction_Implementation() override;
|
virtual void FireWeaponAction_Implementation() override;
|
||||||
|
|
||||||
|
virtual bool UpgradeWeapon_Implementation() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void FireProjectile() override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user