This repository has been archived on 2025-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
2025-03-03 00:13:53 +01:00

126 lines
3.4 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "LMBulletInfo.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/Character.h"
#include "LMPlayer.generated.h"
class UCameraComponent;
class ULMWeaponManager;
class ULMHealthComponent;
class ALMAmmo;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnRequestUnpauseSignature);
UCLASS()
class LEGUMEMIX_API ALMPlayer : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ALMPlayer();
UFUNCTION(BlueprintCallable)
bool PickUpAmmo(ALMAmmo* Ammo);
/**
* Gets the number of ammo from the given type.
* @param AmmoType The ammo type to get.
* @return The amount of ammo from the given type.
*/
UFUNCTION(BlueprintCallable)
int GetAmmoCount(EAmmoType AmmoType) const;
/**
* Removes a given amount of ammo from the type.
* @param AmmoType The type of ammo to remove.
* @param Count The amount of ammo to remove.
* @return The amount that was removed.
*/
UFUNCTION(BlueprintCallable)
int RemoveAmmo(EAmmoType AmmoType, int Count) const;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
UFUNCTION(BlueprintCallable)
ULMWeaponManager* GetWeaponManager() { return WeaponManager; }
UFUNCTION(BlueprintCallable)
void SetWeaponManager(ULMWeaponManager* Manager);
UFUNCTION(BlueprintCallable)
void PlayAnimation(UAnimMontage* Animation);
UFUNCTION(BlueprintCallable)
void FireBullets(const FLMBulletInfo Settings);
UFUNCTION(BlueprintCallable)
FVector GetWeaponFiringOrigin();
UFUNCTION(BlueprintCallable)
FVector GetAimVector();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void WeaponFired();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void WeaponReloaded();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void WeaponSwitched();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void OnAmmoPickup();
UFUNCTION(BlueprintImplementableEvent)
void OnEnnemyHit();
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
void OnFire();
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
void OnReload();
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void OnPause(bool Paused);
public:
UFUNCTION(BlueprintImplementableEvent)
UCameraComponent* GetCamera();
UCameraComponent* GetCam();
UFUNCTION(BlueprintImplementableEvent)
USkeletalMeshComponent* GetArmsBP();
USkeletalMeshComponent* GetArms();
UPROPERTY(BlueprintCallable, BlueprintAssignable, Category=Legumix)
FOnRequestUnpauseSignature OnRequestedUnpause;
private:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
TObjectPtr<ULMWeaponManager> WeaponManager;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
TObjectPtr<USkeletalMeshComponent> ArmsMesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
TObjectPtr<UCameraComponent> Camera;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
TObjectPtr<ULMHealthComponent> HealthComponent;
private:
#if WITH_EDITORONLY_DATA
/** If set, bullet debug will be drawn. */
UPROPERTY(EditAnywhere, Category=Legumix, meta = (AllowPrivateAccess = true))
bool bDrawBulletDebug = false;
#endif
private:
FRandomStream SpreadStream;
};