Added for parent weapon class : Reload and AddAmmo
This commit is contained in:
parent
075533474d
commit
3c68d50ed1
BIN
Binaries/Win64/UnrealEditor-LegumeMix.exp
(Stored with Git LFS)
BIN
Binaries/Win64/UnrealEditor-LegumeMix.exp
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c9a69dc83569b529cbab9a41a0b4a673d1954c0706a7d4fa86941384f9f7ec04
|
oid sha256:bfcad27449bf4813b3c20458b70d67afde0d17f6abcb3d968291708b64a76bd6
|
||||||
size 60411904
|
size 60657664
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "Weapon/Bazoucorn.h"
|
|
9
Source/LegumeMix/Private/Weapon/LMBazoucorn.cpp
Normal file
9
Source/LegumeMix/Private/Weapon/LMBazoucorn.cpp
Normal 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
|
||||||
|
}
|
@ -2,3 +2,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Weapon/LMRadivolver.h"
|
#include "Weapon/LMRadivolver.h"
|
||||||
|
|
||||||
|
void ULMWeapon::Fire()
|
||||||
|
{
|
||||||
|
//Fire like a Radivolver
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -29,5 +29,28 @@ void ULMWeapon::Reload()
|
|||||||
{
|
{
|
||||||
//Do design reload logic
|
//Do design reload logic
|
||||||
OnReload();
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "LMWeapon.h"
|
#include "LMWeapon.h"
|
||||||
#include "Bazoucorn.generated.h"
|
#include "LMBazoucorn.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -27,12 +27,14 @@ public:
|
|||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
void Fire();
|
void Fire();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void Reload();
|
void Reload(); //Reload current clip to max ammo in clip
|
||||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
||||||
void OnReload(); //To call in blueprint for design utilities
|
void OnReload(); //To call in blueprint for design utilities
|
||||||
void AddAmmo();
|
|
||||||
|
void AddAmmo(int AmountOfAmmoToGet); //Add ammo in inventory
|
||||||
|
|
||||||
bool HasAmmoInClip();
|
bool HasAmmoInClip(); //Check if there is ammo in clip (return a bool)
|
||||||
bool HasAmmoInInventory();
|
bool HasAmmoInInventory(); //Check if there is ammo in "inventory" (return a bool)
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "AnimationBlueprintEditorSettings.h"
|
#include "AnimationBlueprintEditorSettings.h"
|
||||||
|
#include "LMAmmo.h"
|
||||||
#include "LMWeaponDataStructure.generated.h"
|
#include "LMWeaponDataStructure.generated.h"
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@ -16,8 +17,8 @@ struct FLMWeaponDataStructure : public FTableRowBase
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TObjectPtr<UStaticMesh> MeshWeapon; //Mesh of the weapon display in the scene
|
TObjectPtr<UStaticMesh> MeshWeapon; //Mesh of the weapon display in the scene
|
||||||
|
|
||||||
//UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
//enum AmmoType; //Type of ammo, which ammo this weapon is using
|
EAmmoType AmmoType; //Type of ammo, which ammo this weapon is using
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TObjectPtr<UAnimBlueprint> AnimationBluePrint; //The animation blueprint to animate the mesh
|
TObjectPtr<UAnimBlueprint> AnimationBluePrint; //The animation blueprint to animate the mesh
|
||||||
|
Reference in New Issue
Block a user