Nakatomi/Source/Nakatomi/NakatomiCharacter.h

128 lines
2.7 KiB
C
Raw Normal View History

2022-12-13 05:11:56 +01:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "HealthComponent.h"
#include "Nakatomi.h"
#include "Throwable.h"
#include "Weapon.h"
2022-12-13 05:11:56 +01:00
#include "NakatomiCharacter.generated.h"
2023-08-02 00:02:32 +02:00
DECLARE_DELEGATE(FOnFireDelegate)
2022-12-13 05:11:56 +01:00
/**
*
*/
UCLASS()
class NAKATOMI_API ANakatomiCharacter : public ACharacter
{
GENERATED_BODY()
2023-08-02 00:02:32 +02:00
public:
FOnFireDelegate OnFired;
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TArray<TSubclassOf<class AWeapon>> DefaultWeaponInventory;
UPROPERTY()
TArray<AWeapon*> WeaponInventory;
UPROPERTY()
AWeapon* CurrentWeapon = nullptr;
2023-09-20 02:56:13 +02:00
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
2024-02-05 23:35:28 +01:00
UPROPERTY(EditDefaultsOnly)
UAnimMontage* FireWeaponAnimMontage;
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
UNakatomiCMC* NakatomiCMC;
2022-12-13 05:11:56 +01:00
private:
UPROPERTY(VisibleDefaultsOnly)
UHealthComponent* HealthComponent = nullptr;
int CurrentInventorySlot = 0;
UPROPERTY(EditDefaultsOnly)
int MaximumThrowableInventorySize = 4;
2022-12-13 05:11:56 +01:00
public:
// Sets default values for this character's properties
ANakatomiCharacter(const FObjectInitializer& ObjectInitializer);
2022-12-13 05:11:56 +01:00
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
2023-06-23 22:06:18 +02:00
public:
2022-12-13 05:11:56 +01:00
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UHealthComponent* GetHealthComponent();
void SetHealthComponent(UHealthComponent* healthComponent);
void SetInventoryToDefault();
void SelectInventorySlot(int slot);
void InventoryIncrement();
void InventoryDecrement();
void AddWeaponToInventory(TSubclassOf<class AWeapon> weapon);
void AddWeaponToInventory(AWeapon* weapon);
void RemoveWeaponFromInventory(int i);
void RemoveWeaponFromInventory(AWeapon* weapon);
void RemoveCurrentWeaponFromInventory();
AWeapon* InitializeWeapon(TSubclassOf<class AWeapon> weapon);
AWeapon* GetCurrentWeapon();
void SetCurrentWeapon(AWeapon* weapon);
int GetCurrentInventorySlot();
2023-03-13 23:01:21 +01:00
virtual void OnFire();
2023-09-20 02:56:13 +02:00
TSubclassOf<AThrowable> PopThrowableFromInventory();
2023-09-20 02:56:13 +02:00
void PushThrowableToInventory(TSubclassOf<AThrowable> Throwable);
UNakatomiCMC* GetCharacterMovementComponent();
UFUNCTION(BlueprintCallable)
bool GetCrouched();
protected:
virtual void CalculateHits(TArray<FHitResult>* hits);
virtual void ProcessHits(TArray<FHitResult> hits);
2024-02-05 23:35:28 +01:00
virtual void PlayOnFireAnimations();
UFUNCTION()
virtual void OnDamaged();
UFUNCTION()
virtual void OnDeath();
2022-12-13 05:11:56 +01:00
};