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
GlobalDefaultGameMode=/Game/TopDown/Blueprints/BP_TopDownGameMode.BP_TopDownGameMode_C
GlobalDefaultServerGameMode=None
GameInstanceClass=/Game/TopDown/Blueprints/BP_GameInstance.BP_GameInstance_C
[/Script/NavigationSystem.RecastNavMesh]
bDrawPolyEdges=False
@ -63,9 +64,9 @@ VerticalDeviationFromGroundCompensation=0.000000
bForceRebuildOnLoad=True
[/Script/Engine.RendererSettings]
r.ReflectionMethod=2
r.GenerateMeshDistanceFields=True
r.DynamicGlobalIlluminationMethod=2
r.ReflectionMethod=0
r.GenerateMeshDistanceFields=False
r.DynamicGlobalIlluminationMethod=0
r.Shadow.Virtual.Enable=1
r.Mobile.EnableNoPrecomputedLightingCSMShader=1
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
@ -74,9 +75,11 @@ r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=true
r.DefaultFeature.LocalExposure.HighlightContrastScale=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.MSAACount=2
r.ForwardShading=False
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
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="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="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="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")

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(
ThisUnit->GetMesh(),
ThisUnit->MeleeMontage[FMath::RandRange(0, ThisUnit->MeleeMontage.Num() -1)]);
if(ThisUnit->AttachedWeaponMesh && ThisUnit->AttachedWeaponMontage)
{
UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage(
ThisUnit->AttachedWeaponMesh,
ThisUnit->AttachedWeaponMontage);
}
ThisUnit->CooldownTimer = 0;
return EBTNodeResult::Succeeded;

@ -36,14 +36,7 @@ void ABasicProjectile::BeginPlay()
}
// Called every frame
void ABasicProjectile::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ABasicProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
void ABasicProjectile::OnSphereOverlap_Implementation(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
FVector UnitDirection = OtherActor->GetActorLocation() - GetActorLocation();
@ -56,4 +49,11 @@ void ABasicProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent,
OtherActor->TakeDamage(Damage, DamageEvent, OwningController, this);
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,
this,
&ASPGameState::FadeCamera,
0.5f);
0.25f);
UStatsSubsystem* StatsSystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
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)
{
LevelSetup = InLevelSetup;
@ -88,6 +49,11 @@ void ASPGameState::StartLevel(FLevelSetup InLevelSetup)
PCUnit->CooldownTimer = PCUnit->Cooldown;
PCUnit->Dexterity = StatsSystem->Dexterity;
PCUnit->ApplyStats();
if (StatsSystem->CurrentWave == 1)
{
StatsSystem->CurrentHP = StatsSystem->MaxHP;
}
Cast<AAIController>(PCUnit->GetController())->MoveToLocation(LevelSetup.RunupPoint);
@ -102,6 +68,40 @@ void ASPGameState::StartLevel(FLevelSetup InLevelSetup)
void ASPGameState::DecrementEnemies()
{
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()
@ -111,7 +111,7 @@ void ASPGameState::TransitionLevel()
FadeHandle,
this,
&ASPGameState::LoadNextLevel,
1);
0.5f);
}
void ASPGameState::SpawnEnemies()
@ -120,18 +120,35 @@ void ASPGameState::SpawnEnemies()
UWorld* World = GetWorld();
URosterSubsystem* RosterSubsystem = GetGameInstance()->GetSubsystem<URosterSubsystem>();
int32 CurrentWave = GetGameInstance()->GetSubsystem<UStatsSubsystem>()->CurrentWave;
int32 TargetChallenge = FMath::FloorToInt(CurrentWave * 1.25f);
while(TargetChallenge > 0)
if(CurrentWave % 10 == 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++;
UStatsSubsystem* StatsSubsystem = GetGameInstance()->GetSubsystem<UStatsSubsystem>();
if(CurrentWave == 10)
{
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;

@ -3,6 +3,15 @@
#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)
{
int32* StatToIncrease = &AttackPower;

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

@ -36,7 +36,7 @@ protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UFUNCTION()
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
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()
public:
ASPGameState();
UFUNCTION(BlueprintCallable, Category="Game Start")
void StartLevel(FLevelSetup InLevelSetup);
UFUNCTION(BlueprintCallable)
void DecrementEnemies();
void PlayerDead();
UPROPERTY(BlueprintReadWrite)
UObject* Saveable;
virtual void Tick(float DeltaSeconds) override;
protected:
UPROPERTY(BlueprintReadOnly)
int32 AliveEnemies = -1;

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

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

@ -8,7 +8,7 @@ public class StreetPunkz : ModuleRules
{
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[] { });

Loading…
Cancel
Save