Added day/night, added the chain daddy, added big cheez

main
Jers 8 months ago
parent be63f6c7e3
commit ba20d7588b

@ -10,6 +10,7 @@ TwoPlayerSplitscreenLayout=Horizontal
ThreePlayerSplitscreenLayout=FavorTop ThreePlayerSplitscreenLayout=FavorTop
GlobalDefaultGameMode=/Game/TopDown/Blueprints/BP_TopDownGameMode.BP_TopDownGameMode_C GlobalDefaultGameMode=/Game/TopDown/Blueprints/BP_TopDownGameMode.BP_TopDownGameMode_C
GlobalDefaultServerGameMode=None GlobalDefaultServerGameMode=None
GameInstanceClass=/Game/TopDown/Blueprints/BP_GameInstance.BP_GameInstance_C
[/Script/NavigationSystem.RecastNavMesh] [/Script/NavigationSystem.RecastNavMesh]
bDrawPolyEdges=False bDrawPolyEdges=False
@ -63,9 +64,9 @@ VerticalDeviationFromGroundCompensation=0.000000
bForceRebuildOnLoad=True bForceRebuildOnLoad=True
[/Script/Engine.RendererSettings] [/Script/Engine.RendererSettings]
r.ReflectionMethod=2 r.ReflectionMethod=0
r.GenerateMeshDistanceFields=True r.GenerateMeshDistanceFields=False
r.DynamicGlobalIlluminationMethod=2 r.DynamicGlobalIlluminationMethod=0
r.Shadow.Virtual.Enable=1 r.Shadow.Virtual.Enable=1
r.Mobile.EnableNoPrecomputedLightingCSMShader=1 r.Mobile.EnableNoPrecomputedLightingCSMShader=1
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
@ -74,9 +75,11 @@ r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=true
r.DefaultFeature.LocalExposure.HighlightContrastScale=0.8 r.DefaultFeature.LocalExposure.HighlightContrastScale=0.8
r.DefaultFeature.LocalExposure.ShadowContrastScale=0.8 r.DefaultFeature.LocalExposure.ShadowContrastScale=0.8
r.Nanite.ProjectEnabled=True r.Nanite.ProjectEnabled=False
r.Nanite = 0
r.DefaultFeature.AutoExposure.Method=1 r.DefaultFeature.AutoExposure.Method=1
r.MSAACount=2 r.MSAACount=2
r.ForwardShading=False
[/Script/WindowsTargetPlatform.WindowsTargetSettings] [/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12 DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
@ -169,7 +172,7 @@ ManualIPAddress=
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.") +Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.") +Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ") +Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="Enemy",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="Enemy",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Player",Response=ECR_Ignore),(Channel="PlayerProjectile",Response=ECR_Overlap)),HelpMessage="Enemy Characters") +Profiles=(Name="Enemy",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="Enemy",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Player",Response=ECR_Ignore),(Channel="PlayerProjectile",Response=ECR_Overlap)),HelpMessage="Enemy Characters")
+Profiles=(Name="Player",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="Player",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Player",Response=ECR_Ignore),(Channel="EnemyProjectile",Response=ECR_Overlap)),HelpMessage="Player Characters") +Profiles=(Name="Player",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="Player",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Player",Response=ECR_Ignore),(Channel="EnemyProjectile",Response=ECR_Overlap)),HelpMessage="Player Characters")
+Profiles=(Name="EnemyProjectile",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="EnemyProjectile",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Player",Response=ECR_Overlap)),HelpMessage="Needs description") +Profiles=(Name="EnemyProjectile",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="EnemyProjectile",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Player",Response=ECR_Overlap)),HelpMessage="Needs description")
+Profiles=(Name="PlayerProjectile",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Overlap),(Channel="Player",Response=ECR_Ignore)),HelpMessage="Needs description") +Profiles=(Name="PlayerProjectile",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Overlap),(Channel="Player",Response=ECR_Ignore)),HelpMessage="Needs description")

BIN
Content/Audio/Death.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/TheDestroyer.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/footstep.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/footstep2.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/glassbreak.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/hit.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/swing.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Audio/throw.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/BattleMap.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/BattleMap_BuiltData.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -31,6 +31,13 @@ EBTNodeResult::Type UBTTask_Attack::ExecuteTask(UBehaviorTreeComponent& OwnerCom
MontageCallbackProxy = UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage( MontageCallbackProxy = UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage(
ThisUnit->GetMesh(), ThisUnit->GetMesh(),
ThisUnit->MeleeMontage[FMath::RandRange(0, ThisUnit->MeleeMontage.Num() -1)]); ThisUnit->MeleeMontage[FMath::RandRange(0, ThisUnit->MeleeMontage.Num() -1)]);
if(ThisUnit->AttachedWeaponMesh && ThisUnit->AttachedWeaponMontage)
{
UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage(
ThisUnit->AttachedWeaponMesh,
ThisUnit->AttachedWeaponMontage);
}
ThisUnit->CooldownTimer = 0; ThisUnit->CooldownTimer = 0;
return EBTNodeResult::Succeeded; return EBTNodeResult::Succeeded;

@ -36,14 +36,7 @@ void ABasicProjectile::BeginPlay()
} }
// Called every frame void ABasicProjectile::OnSphereOverlap_Implementation(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
void ABasicProjectile::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ABasicProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{ {
FVector UnitDirection = OtherActor->GetActorLocation() - GetActorLocation(); FVector UnitDirection = OtherActor->GetActorLocation() - GetActorLocation();
@ -56,4 +49,11 @@ void ABasicProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent,
OtherActor->TakeDamage(Damage, DamageEvent, OwningController, this); OtherActor->TakeDamage(Damage, DamageEvent, OwningController, this);
Destroy(); Destroy();
}
// Called every frame
void ABasicProjectile::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
} }

@ -0,0 +1,27 @@
// Copyright Zelle Games
#include "MoveToRandomSpot.h"
#include "AIController.h"
#include "NavigationSystem.h"
EBTNodeResult::Type UMoveToRandomSpot::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
bNotifyTick = 1;
FNavLocation Loc;
UNavigationSystemV1* NavSystem = UNavigationSystemV1::GetCurrent(GetWorld());
NavSystem->GetRandomReachablePointInRadius(OwnerComp.GetAIOwner()->GetPawn()->GetActorLocation(), 8000, Loc);
OwnerComp.GetAIOwner()->MoveToLocation(Loc.Location);
return EBTNodeResult::InProgress;
}
void UMoveToRandomSpot::TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
TimeSinceExecute += DeltaSeconds;
if(TimeSinceExecute > 2)
{
FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
}
}

@ -16,7 +16,7 @@ void ASPGameState::BeginPlay()
FadeHandle, FadeHandle,
this, this,
&ASPGameState::FadeCamera, &ASPGameState::FadeCamera,
0.5f); 0.25f);
UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>(); UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
if (StatsSystem->CurrentWave == 1) if (StatsSystem->CurrentWave == 1)
@ -25,45 +25,6 @@ void ASPGameState::BeginPlay()
} }
} }
void ASPGameState::Tick(float DeltaSeconds)
{
if(AliveEnemies != -1)
{
if (AliveEnemies == 0 || Cast<AUnit>(PlayerCharacter)->IsDead())
{
ISaveable::Execute_SaveGame(Saveable);
AliveEnemies = -1;
PrimaryActorTick.bCanEverTick = false;
UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
NextLevelName = "BattleMap";
// All enemies dead
if(!Cast<AUnit>(PlayerCharacter)->IsDead())
{
StatsSystem->HighestWave = FMath::Max(StatsSystem->CurrentWave, StatsSystem->HighestWave);
StatsSystem->CurrentWave++;
StatsSystem->CurrentHP = Cast<AUnit>(PlayerCharacter)->HP;
} else
{
StatsSystem->CurrentWave = 1;
}
FTimerHandle RunupHandle;
GetWorld()->GetTimerManager().SetTimer(
RunupHandle,
this,
&ASPGameState::TransitionLevel,
2.0f);
}
}
}
ASPGameState::ASPGameState()
{
PrimaryActorTick.bCanEverTick = true;
}
void ASPGameState::StartLevel(FLevelSetup InLevelSetup) void ASPGameState::StartLevel(FLevelSetup InLevelSetup)
{ {
LevelSetup = InLevelSetup; LevelSetup = InLevelSetup;
@ -88,6 +49,11 @@ void ASPGameState::StartLevel(FLevelSetup InLevelSetup)
PCUnit->CooldownTimer = PCUnit->Cooldown; PCUnit->CooldownTimer = PCUnit->Cooldown;
PCUnit->Dexterity = StatsSystem->Dexterity; PCUnit->Dexterity = StatsSystem->Dexterity;
PCUnit->ApplyStats(); PCUnit->ApplyStats();
if (StatsSystem->CurrentWave == 1)
{
StatsSystem->CurrentHP = StatsSystem->MaxHP;
}
Cast<AAIController>(PCUnit->GetController())->MoveToLocation(LevelSetup.RunupPoint); Cast<AAIController>(PCUnit->GetController())->MoveToLocation(LevelSetup.RunupPoint);
@ -102,6 +68,40 @@ void ASPGameState::StartLevel(FLevelSetup InLevelSetup)
void ASPGameState::DecrementEnemies() void ASPGameState::DecrementEnemies()
{ {
AliveEnemies--; AliveEnemies--;
if (AliveEnemies == 0)
{
ISaveable::Execute_SaveGame(Saveable);
AliveEnemies = -1;
PrimaryActorTick.bCanEverTick = false;
UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
NextLevelName = "BattleMap";
StatsSystem->HighestWave = FMath::Max(StatsSystem->CurrentWave, StatsSystem->HighestWave);
StatsSystem->CurrentWave++;
StatsSystem->CurrentHP = Cast<AUnit>(PlayerCharacter)->HP;
FTimerHandle RunupHandle;
GetWorld()->GetTimerManager().SetTimer(
RunupHandle,
this,
&ASPGameState::TransitionLevel,
0.75f);
}
}
void ASPGameState::PlayerDead()
{
ISaveable::Execute_SaveGame(Saveable);
UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
NextLevelName = "BattleMap";
StatsSystem->CurrentWave = 1;
FTimerHandle RunupHandle;
GetWorld()->GetTimerManager().SetTimer(
RunupHandle,
this,
&ASPGameState::TransitionLevel,
2.0f);
} }
void ASPGameState::TransitionLevel() void ASPGameState::TransitionLevel()
@ -111,7 +111,7 @@ void ASPGameState::TransitionLevel()
FadeHandle, FadeHandle,
this, this,
&ASPGameState::LoadNextLevel, &ASPGameState::LoadNextLevel,
1); 0.5f);
} }
void ASPGameState::SpawnEnemies() void ASPGameState::SpawnEnemies()
@ -120,18 +120,35 @@ void ASPGameState::SpawnEnemies()
UWorld* World = GetWorld(); UWorld* World = GetWorld();
URosterSubsystem* RosterSubsystem = GetGameInstance()->GetSubsystem<URosterSubsystem>(); URosterSubsystem* RosterSubsystem = GetGameInstance()->GetSubsystem<URosterSubsystem>();
int32 CurrentWave = GetGameInstance()->GetSubsystem<UStatsSubsystem>()->CurrentWave; int32 CurrentWave = GetGameInstance()->GetSubsystem<UStatsSubsystem>()->CurrentWave;
int32 TargetChallenge = FMath::FloorToInt(CurrentWave * 1.25f);
if(CurrentWave % 10 == 0)
while(TargetChallenge > 0)
{ {
const URosterEntry* NewEnemy = RosterSubsystem->GetEnemy(TargetChallenge);
FVector SpawnPoint = LevelSetup.EnemySpawnPoints[FMath::RandRange(0, LevelSetup.EnemySpawnPoints.Num() -1)];
FActorSpawnParameters SpawnParams; FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn; SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
AActor* NewActor = World->SpawnActor<ACharacter>(NewEnemy->EnemyUnit.Get(), SpawnPoint, FRotator::ZeroRotator, SpawnParams); UStatsSubsystem* StatsSubsystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
NewActor->Tags.Add("Enemy");
TargetChallenge -= NewEnemy->DifficultyRating; if(CurrentWave == 10)
TotalEnemies++; {
AActor* NewActor = World->SpawnActor<ACharacter>(StatsSubsystem->Bosses[0], LevelSetup.EnemySpawnPoints[0], FRotator::ZeroRotator, SpawnParams);
NewActor->Tags.Add("Enemy");
AliveEnemies = 1;
return;
}
} else
{
int32 TargetChallenge = FMath::FloorToInt(CurrentWave * 1.25f);
while(TargetChallenge > 0)
{
const URosterEntry* NewEnemy = RosterSubsystem->GetEnemy(TargetChallenge);
FVector SpawnPoint = LevelSetup.EnemySpawnPoints[FMath::RandRange(0, LevelSetup.EnemySpawnPoints.Num() -1)];
FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
AActor* NewActor = World->SpawnActor<ACharacter>(NewEnemy->EnemyUnit.Get(), SpawnPoint, FRotator::ZeroRotator, SpawnParams);
NewActor->Tags.Add("Enemy");
TargetChallenge -= NewEnemy->DifficultyRating;
TotalEnemies++;
}
} }
AliveEnemies = TotalEnemies; AliveEnemies = TotalEnemies;

@ -3,6 +3,15 @@
#include "StatsSubsystem.h" #include "StatsSubsystem.h"
#include "Components/DirectionalLightComponent.h"
void UStatsSubsystem::RotateSun(ADirectionalLight* DirectionalLight)
{
float YAngle = SunRotations[(CurrentWave % 3)];
UDirectionalLightComponent* DirectionalLightComponent = Cast<UDirectionalLightComponent>(DirectionalLight->GetLightComponent());
DirectionalLightComponent->SetWorldRotation(FRotator(YAngle, 43, 0));
}
bool UStatsSubsystem::IncreaseStat(FString StatName) bool UStatsSubsystem::IncreaseStat(FString StatName)
{ {
int32* StatToIncrease = &AttackPower; int32* StatToIncrease = &AttackPower;

@ -65,6 +65,11 @@ void AUnit::OnDeath_Implementation()
GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_EngineTraceChannel1, ECR_Ignore); GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_EngineTraceChannel1, ECR_Ignore);
GetWorld()->GetAuthGameMode()->GetGameState<ASPGameState>()->DecrementEnemies(); GetWorld()->GetAuthGameMode()->GetGameState<ASPGameState>()->DecrementEnemies();
} }
if(ActorHasTag("Player"))
{
Cast<ASPGameState>(GetWorld()->GetGameState())->PlayerDead();
}
} }
// Called every frame // Called every frame
@ -185,13 +190,15 @@ float AUnit::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, ACo
HitFromDirection.Z = 0; HitFromDirection.Z = 0;
HitFromDirection.Normalize(); HitFromDirection.Normalize();
const float ActualDamage = DamageAmount * (1 - Defense / (Defense + 5.0f)) + 1; const float ActualDamage = DamageAmount * (1 - Defense / (Defense + 50.0f)) + 1;
HP -= FMath::RoundToInt(ActualDamage); HP -= FMath::RoundToInt(ActualDamage);
HP = FMath::Max(0, HP); HP = FMath::Max(0, HP);
DamageNumberValue = FMath::RoundToInt(ActualDamage); DamageNumberValue = FMath::RoundToInt(ActualDamage);
LaunchCharacter(HitFromDirection * 200.0f, true, false); LaunchCharacter(HitFromDirection * 200.0f, true, false);
Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser); Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
return FMath::RoundToInt(ActualDamage); return FMath::RoundToInt(ActualDamage);
} }
bool AUnit::IsDead() const bool AUnit::IsDead() const

@ -36,7 +36,7 @@ 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;
UFUNCTION() UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor, AActor* OtherActor,
UPrimitiveComponent* OtherComp, UPrimitiveComponent* OtherComp,

@ -0,0 +1,20 @@
// Copyright Zelle Games
#pragma once
#include "CoreMinimal.h"
#include "BehaviorTree/BTTaskNode.h"
#include "MoveToRandomSpot.generated.h"
/**
*
*/
UCLASS()
class STREETPUNKZ_API UMoveToRandomSpot : public UBTTaskNode
{
GENERATED_BODY()
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
virtual void TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override;
float TimeSinceExecute;
};

@ -17,18 +17,16 @@ class STREETPUNKZ_API ASPGameState : public AGameStateBase
GENERATED_BODY() GENERATED_BODY()
public: public:
ASPGameState();
UFUNCTION(BlueprintCallable, Category="Game Start") UFUNCTION(BlueprintCallable, Category="Game Start")
void StartLevel(FLevelSetup InLevelSetup); void StartLevel(FLevelSetup InLevelSetup);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void DecrementEnemies(); void DecrementEnemies();
void PlayerDead();
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
UObject* Saveable; UObject* Saveable;
virtual void Tick(float DeltaSeconds) override;
protected: protected:
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
int32 AliveEnemies = -1; int32 AliveEnemies = -1;

@ -3,6 +3,7 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Engine/DirectionalLight.h"
#include "Subsystems/GameInstanceSubsystem.h" #include "Subsystems/GameInstanceSubsystem.h"
#include "StatsSubsystem.generated.h" #include "StatsSubsystem.generated.h"
@ -15,6 +16,12 @@ class STREETPUNKZ_API UStatsSubsystem : public UGameInstanceSubsystem
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(BlueprintReadWrite)
TArray<float> SunRotations = {2.5f, 294, 350};
UFUNCTION(BlueprintCallable)
void RotateSun(ADirectionalLight* DirectionalLight);
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
int32 CurrentWave = 1; int32 CurrentWave = 1;
@ -48,6 +55,9 @@ public:
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
int32 RecoveryPerTurn = 0; int32 RecoveryPerTurn = 0;
UPROPERTY(BlueprintReadWrite)
TArray<TSubclassOf<AActor>> Bosses;
UFUNCTION(BlueprintCallable, Category="Stats") UFUNCTION(BlueprintCallable, Category="Stats")
bool IncreaseStat(FString StatName); bool IncreaseStat(FString StatName);

@ -91,6 +91,12 @@ public:
UPROPERTY(BlueprintReadWrite, Category="Animations") UPROPERTY(BlueprintReadWrite, Category="Animations")
TArray<UAnimMontage*> DeathMontage; TArray<UAnimMontage*> DeathMontage;
UPROPERTY(BlueprintReadWrite, Category="Animations")
USkeletalMeshComponent* AttachedWeaponMesh;
UPROPERTY(BlueprintReadWrite, Category="Animations")
UAnimMontage* AttachedWeaponMontage;
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
float DamageNumberSpeed = 100.0f; float DamageNumberSpeed = 100.0f;

@ -8,7 +8,7 @@ public class StreetPunkz : ModuleRules
{ {
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "AnimGraphRuntime" }); PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "AnimGraphRuntime", "NavigationSystem", "AIModule" });
PrivateDependencyModuleNames.AddRange(new string[] { }); PrivateDependencyModuleNames.AddRange(new string[] { });

Loading…
Cancel
Save