63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "LMAmmo.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "LMWeaponManager.generated.h"
|
|
|
|
|
|
class ALMWeaponBase;
|
|
class ULMWeapon;
|
|
|
|
UCLASS(Blueprintable, BlueprintType, ClassGroup=Legumix, meta=(BlueprintSpawnableComponent))
|
|
class LEGUMEMIX_API ULMWeaponManager : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ULMWeaponManager();
|
|
void SetArmsMesh(USkeletalMeshComponent* Mesh) { ArmsMesh = Mesh; }
|
|
|
|
public:
|
|
/**
|
|
* Get the Weapon currently equipped.
|
|
* @return The Current Weapon.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
|
ALMWeaponBase* GetCurrentWeapon() { return Weapons[CurrentWeaponIndex]; }
|
|
|
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
|
void SetWeapon(int Index);
|
|
|
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
|
void AddAmmoType(EAmmoType AmmoType, int AmmoCount);
|
|
|
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
|
void Fire();
|
|
|
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
|
void Reload();
|
|
void SwitchWeapon(int Direction);
|
|
|
|
void Initialize(USkeletalMeshComponent* Mesh);
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
|
|
private:
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta = (AllowPrivateAccess = "true"))
|
|
TObjectPtr<USkeletalMeshComponent> ArmsMesh;
|
|
|
|
/** The weapons the player starts with. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
TArray<TSubclassOf<ALMWeaponBase>> StartingWeapons;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
TArray<TObjectPtr<ALMWeaponBase>> Weapons;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
int CurrentWeaponIndex = 0;
|
|
};
|