diff --git a/Config/DefaultEditor.ini b/Config/DefaultEditor.ini index 1beb666..a7bc978 100644 --- a/Config/DefaultEditor.ini +++ b/Config/DefaultEditor.ini @@ -1,5 +1,8 @@ [/Script/UnrealEd.BlueprintEditorProjectSettings] +bForceAllDependenciesToRecompile=False +bValidateUnloadedSoftActorReferences=True bEnableChildActorExpansionInTreeView=False +DefaultChildActorTreeViewMode=ComponentOnly diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index b645b60..234c129 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -3,6 +3,7 @@ [/Script/EngineSettings.GameMapsSettings] GameDefaultMap=/Game/Levels/MainMenu_Level.MainMenu_Level EditorStartupMap=/Game/Levels/StartMap.StartMap +GlobalDefaultGameMode=/Script/SkyFrontier.ScoreAttackGameMode [/Script/HardwareTargeting.HardwareTargetingSettings] TargetedHardwareClass=Desktop diff --git a/Content/Assets/NewTargetSystem/BP_target_marker.uasset b/Content/Assets/NewTargetSystem/BP_target_marker.uasset index 019e395..cc79fea 100644 --- a/Content/Assets/NewTargetSystem/BP_target_marker.uasset +++ b/Content/Assets/NewTargetSystem/BP_target_marker.uasset Binary files differ diff --git a/Content/Assets/NormieAsset/Test_anim.uasset b/Content/Assets/NormieAsset/Test_anim.uasset index e4efcb0..5fb8fda 100644 --- a/Content/Assets/NormieAsset/Test_anim.uasset +++ b/Content/Assets/NormieAsset/Test_anim.uasset Binary files differ diff --git a/Content/Levels/Sergio_Level.umap b/Content/Levels/Sergio_Level.umap index 620029e..76c24a3 100644 --- a/Content/Levels/Sergio_Level.umap +++ b/Content/Levels/Sergio_Level.umap Binary files differ diff --git a/Content/Levels/StartMap.umap b/Content/Levels/StartMap.umap index 86532c7..8070c7a 100644 --- a/Content/Levels/StartMap.umap +++ b/Content/Levels/StartMap.umap Binary files differ diff --git a/Content/Levels/StartMaptEST.umap b/Content/Levels/StartMaptEST.umap index 2f0528f..7a0c036 100644 --- a/Content/Levels/StartMaptEST.umap +++ b/Content/Levels/StartMaptEST.umap Binary files differ diff --git a/Content/PlaneTest/Targets_BP.uasset b/Content/PlaneTest/Targets_BP.uasset index 486399b..1dffec1 100644 --- a/Content/PlaneTest/Targets_BP.uasset +++ b/Content/PlaneTest/Targets_BP.uasset Binary files differ diff --git a/Content/ScoreGameMode_BP.uasset b/Content/ScoreGameMode_BP.uasset new file mode 100644 index 0000000..231820c --- /dev/null +++ b/Content/ScoreGameMode_BP.uasset Binary files differ diff --git a/SkyFrontier.uproject b/SkyFrontier.uproject index c906279..de53b0e 100644 --- a/SkyFrontier.uproject +++ b/SkyFrontier.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "{83C4FF75-46EF-2173-C770-949490863B6F}", + "EngineAssociation": "4.27", "Category": "", "Description": "", "Modules": [ diff --git a/Source/SkyFrontier/Private/DamageSystem.cpp b/Source/SkyFrontier/Private/DamageSystem.cpp index 6ffce29..2109ad6 100644 --- a/Source/SkyFrontier/Private/DamageSystem.cpp +++ b/Source/SkyFrontier/Private/DamageSystem.cpp @@ -1,6 +1,3 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - #include "DamageSystem.h" // Sets default values for this component's properties @@ -14,10 +11,7 @@ // Called when the game starts void UDamageSystem::BeginPlay() { - Super::BeginPlay(); - ShootingDamage = 20; - MissileDamage = 50; - + Super::BeginPlay(); } float UDamageSystem::GetShootingDamage() const diff --git a/Source/SkyFrontier/Private/PointsComponent.cpp b/Source/SkyFrontier/Private/PointsComponent.cpp new file mode 100644 index 0000000..e187107 --- /dev/null +++ b/Source/SkyFrontier/Private/PointsComponent.cpp @@ -0,0 +1,33 @@ +#include "PointsComponent.h" +#include "Net/UnrealNetwork.h" + +UPointsComponent::UPointsComponent() +{ + PrimaryComponentTick.bCanEverTick = false; + PrimaryComponentTick.bStartWithTickEnabled = false; +} + +void UPointsComponent::BeginPlay() +{ + Super::BeginPlay(); + Points = 0; +} + +void UPointsComponent::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const +{ + Super::GetLifetimeReplicatedProps(OutLifetimeProps); + + DOREPLIFETIME(UPointsComponent, Points); +} + +int UPointsComponent::GetPoints() const +{ + return Points; +} + +void UPointsComponent::AddPoints_Implementation(const int PointsToAdd) +{ + Points += PointsToAdd; + + OnPointsReceiveEvent.Broadcast(PointsToAdd); +} \ No newline at end of file diff --git a/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp b/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp new file mode 100644 index 0000000..6d20733 --- /dev/null +++ b/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp @@ -0,0 +1,58 @@ +#include "ScoreAttackGameMode.h" +#include "PointsComponent.h" +#include +#include "GameFramework/Controller.h" + + +AScoreAttackGameMode::AScoreAttackGameMode() +{ + GoalScore = 10; +} + +void AScoreAttackGameMode::PostInitializeComponents() +{ + Super::PostInitializeComponents(); + + TArray FoundActors; + UGameplayStatics::GetAllActorsOfClass(GetWorld(), APawn::StaticClass(), FoundActors); + + if (FoundActors.Num() == 2) + { + UE_LOG(LogTemp, Warning, TEXT("IS THIS WORKING")); + Pawn1 = Cast(FoundActors[0]); + Pawn2 = Cast(FoundActors[1]); + + if (Pawn1 && Pawn2) + { + UE_LOG(LogTemp, Warning, TEXT("IS THIS WORKING")); + PointsComponent1 = Pawn1->FindComponentByClass(); + PointsComponent2 = Pawn2->FindComponentByClass(); + } + } +} + +void AScoreAttackGameMode::BeginPlay() +{ + Super::BeginPlay(); + bGameEnded = false; + UE_LOG(LogTemp, Warning, TEXT("IS THIS WORKING")); +} + +void AScoreAttackGameMode::Tick(const float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + if (PointsComponent1 && PointsComponent2 && !bGameEnded) + { + if (PointsComponent1->Points >= GoalScore) + { + UE_LOG(LogTemp, Warning, TEXT("Player 1 Wins!")); + bGameEnded = true; + } + else if (PointsComponent2->Points >= GoalScore) + { + UE_LOG(LogTemp, Warning, TEXT("Player 2 Wins!")); + bGameEnded = true; + } + } +} \ No newline at end of file diff --git a/Source/SkyFrontier/Private/Test_anim_Class.cpp b/Source/SkyFrontier/Private/Test_anim_Class.cpp new file mode 100644 index 0000000..3820b29 --- /dev/null +++ b/Source/SkyFrontier/Private/Test_anim_Class.cpp @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Test_anim_Class.h" + +// Sets default values +ATest_anim_Class::ATest_anim_Class() +{ + // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void ATest_anim_Class::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void ATest_anim_Class::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + +// Called to bind functionality to input +void ATest_anim_Class::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) +{ + Super::SetupPlayerInputComponent(PlayerInputComponent); + +} + diff --git a/Source/SkyFrontier/Public/DamageSystem.h b/Source/SkyFrontier/Public/DamageSystem.h index 3f660d8..0fc455d 100644 --- a/Source/SkyFrontier/Public/DamageSystem.h +++ b/Source/SkyFrontier/Public/DamageSystem.h @@ -1,5 +1,3 @@ -// Fill out your copyright notice in the Description page of Project Settings. - #pragma once #include "CoreMinimal.h" diff --git a/Source/SkyFrontier/Public/PointsComponent.h b/Source/SkyFrontier/Public/PointsComponent.h new file mode 100644 index 0000000..5248c0f --- /dev/null +++ b/Source/SkyFrontier/Public/PointsComponent.h @@ -0,0 +1,39 @@ +#pragma once + +#include "CoreMinimal.h" +#include "Net/UnrealNetwork.h" +#include "Components/ActorComponent.h" +#include "PointsComponent.generated.h" + +DECLARE_EVENT_OneParam(UCPP_PointsComponent, PointsReceiveEvent, int) + +UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent)) +class SKYFRONTIER_API UPointsComponent : public UActorComponent +{ + GENERATED_BODY() + +public: + UPointsComponent(); + + UFUNCTION(BlueprintCallable, Category = "Points") + int GetPoints() const; + + UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Points") + void AddPoints(int PointsToAdd); + +protected: // Functions + + virtual void BeginPlay() override; + + virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; + + +public: // Events + + PointsReceiveEvent OnPointsReceiveEvent; + +public: + + UPROPERTY(Replicated, VisibleAnywhere, Category = "Points") + int Points; +}; \ No newline at end of file diff --git a/Source/SkyFrontier/Public/ScoreAttackGameMode.h b/Source/SkyFrontier/Public/ScoreAttackGameMode.h new file mode 100644 index 0000000..6afb7c1 --- /dev/null +++ b/Source/SkyFrontier/Public/ScoreAttackGameMode.h @@ -0,0 +1,28 @@ +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/GameModeBase.h" +#include "PointsComponent.h" +#include "ScoreAttackGameMode.generated.h" + +UCLASS() +class SKYFRONTIER_API AScoreAttackGameMode : public AGameModeBase +{ + GENERATED_BODY() + +public: + AScoreAttackGameMode(); + + virtual void PostInitializeComponents() override; + virtual void BeginPlay() override; + virtual void Tick(const float DeltaSeconds) override; + +private: + int GoalScore; + bool bGameEnded; + APawn* Pawn1; + APawn* Pawn2; + UPointsComponent* PointsComponent1; + UPointsComponent* PointsComponent2; + +}; \ No newline at end of file diff --git a/Source/SkyFrontier/Public/Test_anim_Class.h b/Source/SkyFrontier/Public/Test_anim_Class.h new file mode 100644 index 0000000..29a249b --- /dev/null +++ b/Source/SkyFrontier/Public/Test_anim_Class.h @@ -0,0 +1,29 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Pawn.h" +#include "Test_anim_Class.generated.h" + +UCLASS() +class SKYFRONTIER_API ATest_anim_Class : public APawn +{ + GENERATED_BODY() + +public: + // Sets default values for this pawn's properties + ATest_anim_Class(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + + // Called to bind functionality to input + virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; + +};