diff --git a/GravityStomp/Config/DefaultEditor.ini b/GravityStomp/Config/DefaultEditor.ini index 79b70b5..197e527 100644 --- a/GravityStomp/Config/DefaultEditor.ini +++ b/GravityStomp/Config/DefaultEditor.ini @@ -7,3 +7,5 @@ bReplaceBlueprintWithClass= true bDontLoadBlueprintOutsideEditor= true bBlueprintIsNotBlueprintType= true +[/Script/AdvancedPreviewScene.SharedProfiles] + diff --git a/GravityStomp/Content/Characters/BP_GSCharacter.uasset b/GravityStomp/Content/Characters/BP_GSCharacter.uasset index a7ebf57..d41c625 100644 --- a/GravityStomp/Content/Characters/BP_GSCharacter.uasset +++ b/GravityStomp/Content/Characters/BP_GSCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d94c2241734b43189f5520ed0c9bde716f020b67b8231b139429e94a19549d35 -size 34717 +oid sha256:9fe1b1cf455ddcc5020ad3a34569f34be4bf1403d3619a0d6a1bc36ebf27388e +size 36747 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_HeadLegs.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_HeadLegs.uasset new file mode 100644 index 0000000..627e069 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_HeadLegs.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0023622a8b71693b66f3b7fc3698fe7f4d835f78592776fc06b16357b17d135c +size 20749 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_Torso.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_Torso.uasset new file mode 100644 index 0000000..41ad70f --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Blue_Torso.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ad1643f246c71ed8730e2af08d72e53348507481cedc6c02d0d4f87e5d0fe04 +size 21160 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_HeadLegs.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_HeadLegs.uasset new file mode 100644 index 0000000..1c7ff39 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_HeadLegs.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5193392acd7131d74aa87e47f36a89cd97753e60c3b48fdc2869ec0e646f575 +size 20594 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_Torso.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_Torso.uasset new file mode 100644 index 0000000..be45464 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Green_Torso.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb508b774af9a4deea68c8f71c02e924a9e43b6b6024f49bef5bfa90fae8493d +size 21132 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_HeadLegs.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_HeadLegs.uasset new file mode 100644 index 0000000..802c191 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_HeadLegs.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1475d44ca73ef82ed41cda2b311175f2e65fcf42d349e3334530a7943fa831ed +size 20912 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_Torso.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_Torso.uasset new file mode 100644 index 0000000..dad11e7 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Red_Torso.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:584b5a49a46b367ded4a49e595bad5ef96e99310627762640c287317dde78178 +size 21072 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_HeadLegs.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_HeadLegs.uasset new file mode 100644 index 0000000..a686b90 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_HeadLegs.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b75315fc994764514b394f47520e19446f67f21dd2d7ea7ad8397989bbf9cca9 +size 20414 diff --git a/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_Torso.uasset b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_Torso.uasset new file mode 100644 index 0000000..9fd8fa4 --- /dev/null +++ b/GravityStomp/Content/Characters/Mannequins/Materials/Instances/Manny/MI_Manny_Yellow_Torso.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e35038647a9fd046a7bf63d33b6a88c1339388c022f623e2d338952be1a8c65 +size 21007 diff --git a/GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset b/GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset index d0e31a7..45a4b5a 100644 --- a/GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset +++ b/GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e906267de0e2fe0870a99c5f5167ccec9b532b7cebc6db79158ae0a407f6926e -size 33169 +oid sha256:5636e8364eee7c2366845989ea83884c24ec9e7bbfc7326a59ceb31c235e42a3 +size 33264 diff --git a/GravityStomp/Content/Input/IMC_Default.uasset b/GravityStomp/Content/Input/IMC_Default.uasset index 70c1c50..f584a2e 100644 --- a/GravityStomp/Content/Input/IMC_Default.uasset +++ b/GravityStomp/Content/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d1f40f1b3d99628461340618f1e2bb66ffe650d0904979f683b293bae5f2015 -size 9146 +oid sha256:8a602f88eb54fc90a890baf207162cfc93a4da8b0d52f5b96c3d0164f6d29eca +size 15278 diff --git a/GravityStomp/Content/Maps/Debug/Test.umap b/GravityStomp/Content/Maps/Debug/Test.umap index 49ea4ac..69bcac3 100644 --- a/GravityStomp/Content/Maps/Debug/Test.umap +++ b/GravityStomp/Content/Maps/Debug/Test.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cad996f813e5c2b6db3ad6c1b080ed5ca51ea72dc0c070cdac85afd5e253f48c -size 48549 +oid sha256:0883c3b087b4465c8d39ef781b233a57ee40c2f43d5dbc4ca292fdb67ad4b795 +size 53599 diff --git a/GravityStomp/Content/UI/MainMenu/Blueprints/BP_MainMenuGameMode.uasset b/GravityStomp/Content/UI/MainMenu/Blueprints/BP_MainMenuGameMode.uasset index a54ee40..97448e3 100644 --- a/GravityStomp/Content/UI/MainMenu/Blueprints/BP_MainMenuGameMode.uasset +++ b/GravityStomp/Content/UI/MainMenu/Blueprints/BP_MainMenuGameMode.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:615a777c582778522176e7b572f9958c79750b0b0959ec5eb022375140b92671 -size 243549 +oid sha256:d6db31a712880271c12b0e4c6bde351afb28778605a8307596e705ba4251dbd0 +size 281197 diff --git a/GravityStomp/Content/UI/MainMenu/Widgets/WBP_MainMenu.uasset b/GravityStomp/Content/UI/MainMenu/Widgets/WBP_MainMenu.uasset index 65b45b2..ff61897 100644 --- a/GravityStomp/Content/UI/MainMenu/Widgets/WBP_MainMenu.uasset +++ b/GravityStomp/Content/UI/MainMenu/Widgets/WBP_MainMenu.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:427192b8572c38db17febb6419724365df2d97de9d5e9112b10b0c11d1a97397 -size 263855 +oid sha256:1db9cfd16e241bea36113b0b709e7c2eb0db5da09bb395db8a0cb42ccc42b7c5 +size 266287 diff --git a/GravityStomp/Content/UI/MainMenu/Widgets/WBP_PlayerLobby.uasset b/GravityStomp/Content/UI/MainMenu/Widgets/WBP_PlayerLobby.uasset index e4a6309..031ecff 100644 --- a/GravityStomp/Content/UI/MainMenu/Widgets/WBP_PlayerLobby.uasset +++ b/GravityStomp/Content/UI/MainMenu/Widgets/WBP_PlayerLobby.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbbe42b9e378d1b0e93c4052c98738c400ab4774074dc03015627faacfef8404 -size 120368 +oid sha256:ada1a78305e72aa9236043e9bc519d9894ebeb87993f1df1cb0025c4ac902c50 +size 159930 diff --git a/GravityStomp/Source/GravityStompGame/Character/GSCharacter.cpp b/GravityStomp/Source/GravityStompGame/Character/GSCharacter.cpp index 364b19a..d260c9d 100644 --- a/GravityStomp/Source/GravityStompGame/Character/GSCharacter.cpp +++ b/GravityStomp/Source/GravityStompGame/Character/GSCharacter.cpp @@ -10,12 +10,16 @@ #include "EnhancedInputComponent.h" #include "EnhancedInputSubsystems.h" #include "GSCharacterMovementComponent.h" +#include "GameFramework/PlayerState.h" #include "Kismet/KismetMathLibrary.h" +#include "Player/GSPlayerState.h" ////////////////////////////////////////////////////////////////////////// // AGravityStompCharacter +class AGSPlayerState; + AGSCharacter::AGSCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName)) { @@ -46,6 +50,16 @@ AGSCharacter::AGSCharacter(const FObjectInitializer& ObjectInitializer) void AGSCharacter::ChangeTeamColor(bool bIsPlayerFriendly) { + int32 TeamNum = GetPlayerState()->GetTeamNum(); + + // invalid team num + if(TeamNum < 0 || TeamNum >= PlayerMaterials.Num()) + { + return; + } + + GetMesh()->SetMaterial(0, PlayerMaterials[TeamNum].TorsoMaterial); + GetMesh()->SetMaterial(1, PlayerMaterials[TeamNum].HeadLegsMaterial); } @@ -132,3 +146,8 @@ void AGSCharacter::PawnClientRestart() } } } + +void AGSCharacter::PossessedBy(AController* NewController) +{ + Super::PossessedBy(NewController); +} diff --git a/GravityStomp/Source/GravityStompGame/Character/GSCharacter.h b/GravityStomp/Source/GravityStompGame/Character/GSCharacter.h index 3cbe194..6218e43 100644 --- a/GravityStomp/Source/GravityStompGame/Character/GSCharacter.h +++ b/GravityStomp/Source/GravityStompGame/Character/GSCharacter.h @@ -7,6 +7,17 @@ #include "InputActionValue.h" #include "GSCharacter.generated.h" +USTRUCT(BlueprintType) +struct FPlayerMaterial +{ + GENERATED_BODY() + + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) + UMaterialInstance* TorsoMaterial; + + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) + UMaterialInstance* HeadLegsMaterial; +}; UCLASS(config=Game) class AGSCharacter : public ACharacter @@ -24,6 +35,9 @@ class AGSCharacter : public ACharacter UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) class UInputAction* ChangeGravityAction; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player Materials", meta = (AllowPrivateAccess = "true")) + TArray PlayerMaterials; + public: AGSCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); @@ -40,6 +54,8 @@ protected: public: virtual void PawnClientRestart() override; + virtual void PossessedBy(AController* NewController) override; + protected: // APawn interface virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; diff --git a/GravityStomp/Source/GravityStompGame/GameModes/GSGameModeBase.cpp b/GravityStomp/Source/GravityStompGame/GameModes/GSGameModeBase.cpp index 99cedc8..765b73b 100644 --- a/GravityStomp/Source/GravityStompGame/GameModes/GSGameModeBase.cpp +++ b/GravityStomp/Source/GravityStompGame/GameModes/GSGameModeBase.cpp @@ -113,6 +113,7 @@ bool AGSGameModeBase::CanDamagePlayer(AGSPlayerController* Damager, AGSPlayerCon void AGSGameModeBase::PickTeam(AGSPlayerState* PlayerState) { + /* // place player on the team with the fewest players, or on the first team if all teams have the same number of players TArray NumTeamPlayers; AGSGameState* GS = GetGameState(); @@ -141,8 +142,9 @@ void AGSGameModeBase::PickTeam(AGSPlayerState* PlayerState) LowestTeamIdx = TeamIdx; } } + */ - PlayerState->SetTeamNum(LowestTeamIdx); + PlayerState->SetTeamNum(PlayerState->GetPlayerController()->GetLocalPlayer()->GetControllerId()); } diff --git a/GravityStomp/Source/GravityStompGame/Player/GSPlayerController.cpp b/GravityStomp/Source/GravityStompGame/Player/GSPlayerController.cpp index d4e3d38..1bf9a76 100644 --- a/GravityStomp/Source/GravityStompGame/Player/GSPlayerController.cpp +++ b/GravityStomp/Source/GravityStompGame/Player/GSPlayerController.cpp @@ -2,10 +2,11 @@ #include "Player/GSPlayerController.h" +// GS includes +#include "GSPlayerState.h" + void AGSPlayerController::Client_GameStarted_Implementation() { - FInputModeGameOnly GameOnly; - SetInputMode(GameOnly); SetIgnoreMoveInput(false); // enable all actions on pawn @@ -64,6 +65,8 @@ void AGSPlayerController::UnFreeze() void AGSPlayerController::AcknowledgePossession(APawn* P) { + GetPlayerState()->UpdateTeamColor(); + OnAcknowledgePossession(); Super::AcknowledgePossession(P); diff --git a/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.cpp b/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.cpp index d393cfd..b8585de 100644 --- a/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.cpp +++ b/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.cpp @@ -26,6 +26,13 @@ void AGSPlayerState::SetTeamNum(int32 InTeamNum) void AGSPlayerState::UpdateTeamColor() { + AGSCharacter* Char = GetPawn(); + if(Char) + { + Char->ChangeTeamColor(false); + } + + /* AGSPlayerState* LocalPS = GetWorld()->GetFirstPlayerController()->GetPlayerState(); // if this player state belongs to us then we need to update all other characters // rendering of team will essentially flip (all enemies are now rendered as friendly and vice versa) @@ -49,9 +56,10 @@ void AGSPlayerState::UpdateTeamColor() AGSCharacter* Char = GetPawn(); if(Char && LocalPS) { - Char->ChangeTeamColor(IsPlayerFriendly(LocalPS)); + } } + */ } diff --git a/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.h b/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.h index 6dbd1ce..aa63eb0 100644 --- a/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.h +++ b/GravityStomp/Source/GravityStompGame/Player/GSPlayerState.h @@ -24,6 +24,11 @@ public: void SetTeamNum(int32 InTeamNum); + /** + * Changes how this player is rendered depending on their team number + */ + void UpdateTeamColor(); + UFUNCTION(BlueprintPure) FORCEINLINE int32 GetNumKills() const { return NumKills; } @@ -65,9 +70,4 @@ protected: UFUNCTION() void OnRep_TeamNum(); - - /** - * Changes how this player is rendered to a client - */ - void UpdateTeamColor(); };