diff --git a/Content/Assets/NewTargetSystem/Targets_BP.uasset b/Content/Assets/NewTargetSystem/Targets_BP.uasset index 1491d03..aead2de 100644 --- a/Content/Assets/NewTargetSystem/Targets_BP.uasset +++ b/Content/Assets/NewTargetSystem/Targets_BP.uasset Binary files differ diff --git a/Content/Assets/NormieAsset/Test_anim.uasset b/Content/Assets/NormieAsset/Test_anim.uasset index 09ebd63..1af695d 100644 --- a/Content/Assets/NormieAsset/Test_anim.uasset +++ b/Content/Assets/NormieAsset/Test_anim.uasset Binary files differ diff --git a/Content/Levels/StartMap.umap b/Content/Levels/StartMap.umap index 2485aa8..850fea2 100644 --- a/Content/Levels/StartMap.umap +++ b/Content/Levels/StartMap.umap Binary files differ diff --git a/Content/NunoContent/Menus/Widgets/MainMenu_Widget.uasset b/Content/NunoContent/Menus/Widgets/MainMenu_Widget.uasset index 9f9d47d..0c61959 100644 --- a/Content/NunoContent/Menus/Widgets/MainMenu_Widget.uasset +++ b/Content/NunoContent/Menus/Widgets/MainMenu_Widget.uasset Binary files differ diff --git a/Content/ScoreGameMode_BP.uasset b/Content/ScoreGameMode_BP.uasset index 1c60468..b1bf758 100644 --- a/Content/ScoreGameMode_BP.uasset +++ b/Content/ScoreGameMode_BP.uasset Binary files differ diff --git a/Source/SkyFrontier/Private/PointsComponent.cpp b/Source/SkyFrontier/Private/PointsComponent.cpp index e187107..9d8b267 100644 --- a/Source/SkyFrontier/Private/PointsComponent.cpp +++ b/Source/SkyFrontier/Private/PointsComponent.cpp @@ -10,24 +10,38 @@ void UPointsComponent::BeginPlay() { Super::BeginPlay(); - Points = 0; + P1Points = 0; + P2Points = 0; } void UPointsComponent::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); - DOREPLIFETIME(UPointsComponent, Points); + DOREPLIFETIME(UPointsComponent, P1Points); + DOREPLIFETIME(UPointsComponent, P2Points); } -int UPointsComponent::GetPoints() const +int UPointsComponent::GetP1Points() const { - return Points; + return P1Points; } -void UPointsComponent::AddPoints_Implementation(const int PointsToAdd) +int UPointsComponent::GetP2Points() const { - Points += PointsToAdd; + return P2Points; +} + +void UPointsComponent::AddP1Points_Implementation(const int PointsToAdd) +{ + P1Points += PointsToAdd; + + OnPointsReceiveEvent.Broadcast(PointsToAdd); +} + +void UPointsComponent::AddP2Points_Implementation(const int PointsToAdd) +{ + P2Points += PointsToAdd; OnPointsReceiveEvent.Broadcast(PointsToAdd); } \ No newline at end of file diff --git a/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp b/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp index 93c8f34..049579b 100644 --- a/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp +++ b/Source/SkyFrontier/Private/ScoreAttackGameMode.cpp @@ -42,12 +42,12 @@ if (PointsComponent1 && PointsComponent2 && !bGameEnded) { - if (PointsComponent1->Points >= GoalScore) + if (PointsComponent1->P1Points >= GoalScore) { UE_LOG(LogTemp, Warning, TEXT("Player 1 Wins!")); bGameEnded = true; } - else if (PointsComponent2->Points >= GoalScore) + else if (PointsComponent2->P2Points >= GoalScore) { UE_LOG(LogTemp, Warning, TEXT("Player 2 Wins!")); bGameEnded = true; diff --git a/Source/SkyFrontier/Public/PointsComponent.h b/Source/SkyFrontier/Public/PointsComponent.h index 5248c0f..b0cee5c 100644 --- a/Source/SkyFrontier/Public/PointsComponent.h +++ b/Source/SkyFrontier/Public/PointsComponent.h @@ -16,10 +16,14 @@ UPointsComponent(); UFUNCTION(BlueprintCallable, Category = "Points") - int GetPoints() const; + int GetP1Points() const; + UFUNCTION(BlueprintCallable, Category = "Points") +int GetP2Points() const; UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Points") - void AddPoints(int PointsToAdd); + void AddP1Points(int PointsToAdd); + UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Points") + void AddP2Points(int PointsToAdd); protected: // Functions @@ -35,5 +39,7 @@ public: UPROPERTY(Replicated, VisibleAnywhere, Category = "Points") - int Points; + int P1Points; + UPROPERTY(Replicated, VisibleAnywhere, Category = "Points") + int P2Points; }; \ No newline at end of file