Merge remote-tracking branch 'origin/add-weapon' into add-weapon

# Conflicts:
#	Content/Legumix/Player/BP_Player.uasset
#	Source/LegumeMix/Private/Player/LMPlayer.cpp
This commit is contained in:
TjgL 2025-01-21 16:34:10 +01:00
commit 4361f1ebf2
18 changed files with 288 additions and 101 deletions

View File

@ -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",

BIN
Binaries/Win64/UnrealEditor-LegumeMix.exp (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c9a69dc83569b529cbab9a41a0b4a673d1954c0706a7d4fa86941384f9f7ec04
size 60411904
oid sha256:bfcad27449bf4813b3c20458b70d67afde0d17f6abcb3d968291708b64a76bd6
size 60657664

BIN
Content/Legumix/BP_GameMode.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Weapon/BP_Ammo.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,4 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Weapon/Bazoucorn.h"
#include "LMGameMode.h"

View File

@ -4,10 +4,12 @@
#include "Player/LMPlayer.h"
#include "Camera/CameraComponent.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;
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
@ -19,9 +21,20 @@ ALMPlayer::ALMPlayer()
WeaponSkeletalMeshComponent->SetupAttachment(Camera);
}
// 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);
}
}
void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
@ -37,13 +50,17 @@ void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
WeaponManager->Initialize(WeaponSkeletalMeshComponent);
}
// 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);
}

View File

@ -19,13 +19,15 @@ void ALMPlayerController::BeginPlay()
void ALMPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(InputComponent);
if(UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(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)
{

View File

@ -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<UStaticMeshComponent>(TEXT("AmmoMeshComponent"));
RootComponent = AmmoMeshComponent;
CollisionSphere = CreateDefaultSubobject<USphereComponent>(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<ALMPlayer>(OtherActor))
{
Player->PickUpAmmo(this);
Destroy();
}
}
void ALMAmmo::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,9 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Weapon\LMBazoucorn.h"
void ULMWeapon::Fire()
{
//Fire like a Bazoucorn
}

View File

@ -2,3 +2,9 @@
#include "Weapon/LMRadivolver.h"
void ULMWeapon::Fire()
{
//Fire like a Radivolver
}

View File

@ -29,5 +29,28 @@ void ULMWeapon::Reload()
{
//Do design reload logic
OnReload();
if(HasAmmoInClip())
{
if(CurrentAmmoInInventory >= WeaponDataStructure.MaxClipAmmo)
{
CurrentClipAmmo = WeaponDataStructure.MaxClipAmmo;
CurrentAmmoInInventory -= WeaponDataStructure.MaxClipAmmo;
}
else
{
CurrentClipAmmo = CurrentAmmoInInventory;
CurrentAmmoInInventory = 0;
}
}
}
void ULMWeapon::AddAmmo(int AmountOfAmmoToGet)
{
CurrentAmmoInInventory += AmountOfAmmoToGet;
}
void ULMWeapon::Fire()
{
//Fire
}

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "LMGameMode.generated.h"
/**
*
*/
UCLASS()
class LEGUMEMIX_API ALMGameMode : public AGameModeBase
{
GENERATED_BODY()
};

View File

@ -9,17 +9,24 @@
class UCameraComponent;
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:

View File

@ -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<UStaticMeshComponent> AmmoMeshComponent;
UPROPERTY(EditAnywhere)
TObjectPtr<USphereComponent> 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);
};

View File

@ -4,7 +4,7 @@
#include "CoreMinimal.h"
#include "LMWeapon.h"
#include "Bazoucorn.generated.h"
#include "LMBazoucorn.generated.h"
/**
*

View File

@ -27,12 +27,14 @@ public:
void Initialize();
void Fire();
UFUNCTION(BlueprintCallable)
void Reload();
void Reload(); //Reload current clip to max ammo in clip
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void OnReload(); //To call in blueprint for design utilities
void AddAmmo();
bool HasAmmoInClip();
bool HasAmmoInInventory();
void AddAmmo(int AmountOfAmmoToGet); //Add ammo in inventory
bool HasAmmoInClip(); //Check if there is ammo in clip (return a bool)
bool HasAmmoInInventory(); //Check if there is ammo in "inventory" (return a bool)
};

View File

@ -1,5 +1,6 @@
#pragma once
#include "AnimationBlueprintEditorSettings.h"
#include "LMAmmo.h"
#include "LMWeaponDataStructure.generated.h"
USTRUCT(BlueprintType)
@ -16,8 +17,8 @@ struct FLMWeaponDataStructure : public FTableRowBase
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<USkeletalMesh> MeshWeapon; //Mesh of the weapon display in the scene
//UPROPERTY(EditAnywhere, BlueprintReadWrite)
//enum AmmoType; //Type of ammo, which ammo this weapon is using
UPROPERTY(EditAnywhere, BlueprintReadWrite)
EAmmoType AmmoType; //Type of ammo, which ammo this weapon is using
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UAnimBlueprint> AnimationBluePrint; //The animation blueprint to animate the mesh