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.

83 lines
2.2 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 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(BlueprintCallable)
void 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() const;
UFUNCTION(BlueprintCallable)
FVector GetAimVector() const;
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;
private:
FRandomStream SpreadStream;
};