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
|
||||
oid sha256:c9a69dc83569b529cbab9a41a0b4a673d1954c0706a7d4fa86941384f9f7ec04
|
||||
size 60411904
|
||||
oid sha256:bfcad27449bf4813b3c20458b70d67afde0d17f6abcb3d968291708b64a76bd6
|
||||
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"
|
||||
|
||||
void ULMWeapon::Fire()
|
||||
{
|
||||
//Fire like a Radivolver
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "LMWeapon.h"
|
||||
#include "Bazoucorn.generated.h"
|
||||
#include "LMBazoucorn.generated.h"
|
||||
|
||||
/**
|
||||
*
|
@ -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();
|
||||
|
||||
void AddAmmo(int AmountOfAmmoToGet); //Add ammo in inventory
|
||||
|
||||
bool HasAmmoInClip();
|
||||
bool HasAmmoInInventory();
|
||||
bool HasAmmoInClip(); //Check if there is ammo in clip (return a bool)
|
||||
bool HasAmmoInInventory(); //Check if there is ammo in "inventory" (return a bool)
|
||||
};
|
||||
|
@ -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<UStaticMesh> 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
|
||||
|
Reference in New Issue
Block a user