From dde9f349583404421730e0f6e022cb49581d3103 Mon Sep 17 00:00:00 2001 From: Emilie Schott Date: Tue, 21 Jan 2025 16:03:24 +0100 Subject: [PATCH] Added : Ammo files --- Binaries/Win64/LegumeMixEditor.target | 168 +++++++++--------- Content/Legumix/Player/BP_Player.uasset | 4 +- Content/Legumix/Weapon/BP_Ammo.uasset | 3 + Source/LegumeMix/Private/Player/LMPlayer.cpp | 18 +- .../Private/Player/LMPlayerController.cpp | 14 +- Source/LegumeMix/Private/Weapon/LMAmmo.cpp | 43 +++++ Source/LegumeMix/Public/Player/LMPlayer.h | 7 + Source/LegumeMix/Public/Weapon/LMAmmo.h | 50 ++++++ 8 files changed, 217 insertions(+), 90 deletions(-) create mode 100644 Content/Legumix/Weapon/BP_Ammo.uasset create mode 100644 Source/LegumeMix/Private/Weapon/LMAmmo.cpp create mode 100644 Source/LegumeMix/Public/Weapon/LMAmmo.h diff --git a/Binaries/Win64/LegumeMixEditor.target b/Binaries/Win64/LegumeMixEditor.target index 7b8d3b5..314c033 100644 --- a/Binaries/Win64/LegumeMixEditor.target +++ b/Binaries/Win64/LegumeMixEditor.target @@ -21,6 +21,18 @@ "BuildId": "37670630" }, "BuildProducts": [ + { + "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor-LegumeMix.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor-LegumeMix.pdb", + "Type": "SymbolFile" + }, + { + "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor.modules", + "Type": "RequiredResource" + }, { "Path": "$(EngineDir)/Binaries/ThirdParty/USD/UsdResources/Win64/plugins/ar/resources/plugInfo.json", "Type": "RequiredResource" @@ -2833,6 +2845,50 @@ "Path": "$(EngineDir)/Plugins/Animation/LiveLink/Binaries/Win64/UnrealEditor.modules", "Type": "RequiredResource" }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor-RigLogicDeveloper.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor-RigLogicEditor.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor-RigLogicLib.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor-RigLogicLibTest.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor-RigLogicModule.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/Binaries/Win64/UnrealEditor.modules", + "Type": "RequiredResource" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Binaries/Win64/UnrealEditor-Bridge.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Binaries/Win64/UnrealEditor-Bridge.pdb", + "Type": "SymbolFile" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Binaries/Win64/UnrealEditor-MegascansPlugin.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Binaries/Win64/UnrealEditor-MegascansPlugin.pdb", + "Type": "SymbolFile" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Binaries/Win64/UnrealEditor.modules", + "Type": "RequiredResource" + }, { "Path": "$(EngineDir)/Plugins/Cameras/CameraShakePreviewer/Binaries/Win64/UnrealEditor-CameraShakePreviewer.dll", "Type": "DynamicLibrary" @@ -3665,6 +3721,18 @@ "Path": "$(EngineDir)/Plugins/Experimental/MeshModelingToolsetExp/Binaries/Win64/UnrealEditor.modules", "Type": "RequiredResource" }, + { + "Path": "$(EngineDir)/Plugins/Experimental/MetaHuman/MetaHumanSDK/Binaries/Win64/UnrealEditor-MetaHumanSDKEditor.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Experimental/MetaHuman/MetaHumanSDK/Binaries/Win64/UnrealEditor-MetaHumanSDKRuntime.dll", + "Type": "DynamicLibrary" + }, + { + "Path": "$(EngineDir)/Plugins/Experimental/MetaHuman/MetaHumanSDK/Binaries/Win64/UnrealEditor.modules", + "Type": "RequiredResource" + }, { "Path": "$(EngineDir)/Plugins/Experimental/NFORDenoise/Binaries/Win64/UnrealEditor-NFORDenoise.dll", "Type": "DynamicLibrary" @@ -3889,66 +3957,6 @@ "Path": "$(EngineDir)/Plugins/Interchange/Runtime/Binaries/Win64/UnrealEditor.modules", "Type": "RequiredResource" }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RD.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RD.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderBlueprint.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderBlueprint.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderGameControl.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderGameControl.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLC.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLC.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLink.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLink.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLogging.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderLogging.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderShaderInfo.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor-RiderShaderInfo.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/Binaries/Win64/UnrealEditor.modules", - "Type": "RequiredResource" - }, { "Path": "$(EngineDir)/Plugins/Media/AndroidMedia/Binaries/Win64/UnrealEditor-AndroidMediaEditor.dll", "Type": "DynamicLibrary" @@ -4808,21 +4816,13 @@ { "Path": "$(EngineDir)/Plugins/XGEController/Binaries/Win64/UnrealEditor.modules", "Type": "RequiredResource" - }, - { - "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor-LegumeMix.dll", - "Type": "DynamicLibrary" - }, - { - "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor-LegumeMix.pdb", - "Type": "SymbolFile" - }, - { - "Path": "$(ProjectDir)/Binaries/Win64/UnrealEditor.modules", - "Type": "RequiredResource" } ], "RuntimeDependencies": [ + { + "Path": "$(ProjectDir)/LegumeMix.uproject", + "Type": "UFS" + }, { "Path": "$(EngineDir)/Binaries/ThirdParty/DbgHelp/dbghelp.dll", "Type": "NonUFS" @@ -29839,6 +29839,14 @@ "Path": "$(EngineDir)/Plugins/Animation/LiveLink/LiveLink.uplugin", "Type": "UFS" }, + { + "Path": "$(EngineDir)/Plugins/Animation/RigLogic/RigLogic.uplugin", + "Type": "UFS" + }, + { + "Path": "$(EngineDir)/Plugins/Bridge/Bridge.uplugin", + "Type": "UFS" + }, { "Path": "$(EngineDir)/Plugins/Cameras/CameraShakePreviewer/CameraShakePreviewer.uplugin", "Type": "UFS" @@ -30179,6 +30187,10 @@ "Path": "$(EngineDir)/Plugins/Experimental/MeshModelingToolsetExp/MeshModelingToolsetExp.uplugin", "Type": "UFS" }, + { + "Path": "$(EngineDir)/Plugins/Experimental/MetaHuman/MetaHumanSDK/MetaHumanSDK.uplugin", + "Type": "UFS" + }, { "Path": "$(EngineDir)/Plugins/Experimental/NFORDenoise/NFORDenoise.uplugin", "Type": "UFS" @@ -30239,10 +30251,6 @@ "Path": "$(EngineDir)/Plugins/Interchange/Runtime/Interchange.uplugin", "Type": "UFS" }, - { - "Path": "$(EngineDir)/Plugins/Marketplace/Developer/RiderLink/RiderLink.uplugin", - "Type": "UFS" - }, { "Path": "$(EngineDir)/Plugins/Media/AndroidMedia/AndroidMedia.uplugin", "Type": "UFS" @@ -30538,10 +30546,6 @@ { "Path": "$(EngineDir)/Plugins/XGEController/XGEController.uplugin", "Type": "UFS" - }, - { - "Path": "$(ProjectDir)/LegumeMix.uproject", - "Type": "UFS" } ], "BuildPlugins": [ @@ -30573,6 +30577,7 @@ "BaseCharacterFXEditor", "BlendSpaceMotionAnalysis", "BlueprintHeaderView", + "Bridge", "CLionSourceCodeAccess", "CableComponent", "CameraShakePreviewer", @@ -30661,6 +30666,7 @@ "MeshModelingToolset", "MeshModelingToolsetExp", "MeshPainting", + "MetaHumanSDK", "Metasound", "MobileLauncherProfileWizard", "MobilePatchingUtils", @@ -30699,8 +30705,8 @@ "RenderDocPlugin", "RenderGraphInsights", "ResonanceAudio", - "RiderLink", "RiderSourceCodeAccess", + "RigLogic", "RigVM", "SQLiteCore", "SequencerAnimTools", diff --git a/Content/Legumix/Player/BP_Player.uasset b/Content/Legumix/Player/BP_Player.uasset index 53b0c53..0f797c6 100644 --- a/Content/Legumix/Player/BP_Player.uasset +++ b/Content/Legumix/Player/BP_Player.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2db256cc9494b901f3f24e4b4d66f8d720b60fba52d250d031e334c0cfd5b5fc -size 35424 +oid sha256:d13142befdccaf0a6e255f0ba55b1fbbfe764f1846950d8b6088aa3d00eca516 +size 34593 diff --git a/Content/Legumix/Weapon/BP_Ammo.uasset b/Content/Legumix/Weapon/BP_Ammo.uasset new file mode 100644 index 0000000..67df7d4 --- /dev/null +++ b/Content/Legumix/Weapon/BP_Ammo.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c05e55130308441515ad0dd36070015a59d36d0cd874aea6f533082a4603e29 +size 33124 diff --git a/Source/LegumeMix/Private/Player/LMPlayer.cpp b/Source/LegumeMix/Private/Player/LMPlayer.cpp index ea031d4..135d138 100644 --- a/Source/LegumeMix/Private/Player/LMPlayer.cpp +++ b/Source/LegumeMix/Private/Player/LMPlayer.cpp @@ -2,11 +2,12 @@ #include "Player/LMPlayer.h" - +#include "Weapon/LMAmmo.h" #include "Weapon/LMWeaponManager.h" ALMPlayer::ALMPlayer() { + // Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; WeaponManager = CreateDefaultSubobject(TEXT("Weapon Manager")); @@ -17,18 +18,33 @@ ALMPlayer::ALMPlayer() WeaponManager->SetWeaponMeshComponent(WeaponSkeletalMeshComponent); } +// Called when the game starts or when spawned void ALMPlayer::BeginPlay() { Super::BeginPlay(); + } +void ALMPlayer::PickUpAmmo(ALMAmmo* Ammo) +{ + if (GEngine) + { + FString AmmoAmount = FString::Printf(TEXT("Quantité de munition : %i"), Ammo->GetAmmoAmount()); + GEngine->AddOnScreenDebugMessage(1, 30.f, FColor::Red, AmmoAmount); + } +} + +// Called every frame void ALMPlayer::Tick(float DeltaTime) { Super::Tick(DeltaTime); + } +// Called to bind functionality to input void ALMPlayer::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); + } diff --git a/Source/LegumeMix/Private/Player/LMPlayerController.cpp b/Source/LegumeMix/Private/Player/LMPlayerController.cpp index 06aff27..27bed09 100644 --- a/Source/LegumeMix/Private/Player/LMPlayerController.cpp +++ b/Source/LegumeMix/Private/Player/LMPlayerController.cpp @@ -19,12 +19,14 @@ void ALMPlayerController::BeginPlay() void ALMPlayerController::SetupInputComponent() { Super::SetupInputComponent(); - UEnhancedInputComponent* Input = Cast(InputComponent); - Input->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Move); - Input->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Jump); - Input->BindAction(LookAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Look); - Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire); - Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload); + if(UEnhancedInputComponent* Input = Cast(InputComponent)) + { + Input->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Move); + Input->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Jump); + Input->BindAction(LookAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Look); + Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire); + Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload); + } } void ALMPlayerController::Move(const FInputActionValue& InputValue) diff --git a/Source/LegumeMix/Private/Weapon/LMAmmo.cpp b/Source/LegumeMix/Private/Weapon/LMAmmo.cpp new file mode 100644 index 0000000..2fee821 --- /dev/null +++ b/Source/LegumeMix/Private/Weapon/LMAmmo.cpp @@ -0,0 +1,43 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Weapon/LMAmmo.h" + +#include "Components/BoxComponent.h" +#include "Components/SphereComponent.h" +#include "Player/LMPlayer.h" + +// Sets default values +ALMAmmo::ALMAmmo() +{ + PrimaryActorTick.bCanEverTick = true; + AmmoMeshComponent = CreateDefaultSubobject(TEXT("AmmoMeshComponent")); + RootComponent = AmmoMeshComponent; + CollisionSphere = CreateDefaultSubobject(TEXT("CollisionSphere")); + CollisionSphere->SetupAttachment(RootComponent); + CollisionSphere->OnComponentBeginOverlap.AddDynamic(this, &ALMAmmo::OnSphereOverlap); + AmmoType = EAmmoType::EAT_RadishAmmo; + AmmoAmount = 1; + +} + +void ALMAmmo::BeginPlay() +{ + Super::BeginPlay(); +} + +void ALMAmmo::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, + UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) +{ + if (ALMPlayer* Player = Cast(OtherActor)) + { + Player->PickUpAmmo(this); + Destroy(); + } +} + +void ALMAmmo::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); +} + diff --git a/Source/LegumeMix/Public/Player/LMPlayer.h b/Source/LegumeMix/Public/Player/LMPlayer.h index 49ddd12..55bf134 100644 --- a/Source/LegumeMix/Public/Player/LMPlayer.h +++ b/Source/LegumeMix/Public/Player/LMPlayer.h @@ -8,17 +8,24 @@ class ULMWeaponManager; +class ALMAmmo; + UCLASS() class LEGUMEMIX_API ALMPlayer : public ACharacter { GENERATED_BODY() public: + // Sets default values for this character's properties ALMPlayer(); virtual void Tick(float DeltaTime) override; virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; + + UFUNCTION() + void PickUpAmmo(ALMAmmo* Ammo); protected: + // Called when the game starts or when spawned virtual void BeginPlay() override; public: diff --git a/Source/LegumeMix/Public/Weapon/LMAmmo.h b/Source/LegumeMix/Public/Weapon/LMAmmo.h new file mode 100644 index 0000000..d397a72 --- /dev/null +++ b/Source/LegumeMix/Public/Weapon/LMAmmo.h @@ -0,0 +1,50 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "LMAmmo.generated.h" + +class USphereComponent; + +UENUM(BlueprintType) +enum class EAmmoType : uint8 +{ + EAT_RadishAmmo UMETA(DisplayName = "Radish Ammo"), + EAT_CornAmmo UMETA(DisplayName = "Corn Ammo") +}; + +UCLASS() +class LEGUMEMIX_API ALMAmmo : public AActor +{ + GENERATED_BODY() + +public: + ALMAmmo(); + virtual void Tick(float DeltaTime) override; + + UFUNCTION(BlueprintCallable) + inline int GetAmmoAmount() { return AmmoAmount; } + + UFUNCTION(BlueprintCallable) + inline EAmmoType GetAmmoType() { return AmmoType; } + +protected: + virtual void BeginPlay() override; + + UPROPERTY(EditAnywhere) + TObjectPtr AmmoMeshComponent; + + UPROPERTY(EditAnywhere) + TObjectPtr CollisionSphere; + + UPROPERTY(EditAnywhere) + EAmmoType AmmoType; + + UPROPERTY(EditAnywhere) + int AmmoAmount; + + UFUNCTION(BlueprintCallable) + void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); +};