2022-12-13 04:11:56 +00: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"
|
2024-01-11 19:21:15 +00:00
|
|
|
#include "Nakatomi.h"
|
2023-09-13 16:53:39 +01:00
|
|
|
#include "Throwable.h"
|
2023-02-09 21:56:52 +00:00
|
|
|
#include "Weapon.h"
|
2022-12-13 04:11:56 +00:00
|
|
|
#include "NakatomiCharacter.generated.h"
|
|
|
|
|
2023-08-01 23:02:32 +01:00
|
|
|
|
|
|
|
DECLARE_DELEGATE(FOnFireDelegate)
|
|
|
|
|
|
|
|
|
2022-12-13 04:11:56 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
UCLASS()
|
|
|
|
class NAKATOMI_API ANakatomiCharacter : public ACharacter
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
2023-08-01 23:02:32 +01:00
|
|
|
public:
|
|
|
|
|
|
|
|
FOnFireDelegate OnFired;
|
|
|
|
|
2023-02-09 21:56:52 +00:00
|
|
|
public:
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
|
|
|
TArray<TSubclassOf<class AWeapon>> DefaultWeaponInventory;
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
TArray<AWeapon*> WeaponInventory;
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
AWeapon* CurrentWeapon = nullptr;
|
|
|
|
|
2023-09-20 01:56:13 +01:00
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
|
|
|
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
|
2023-09-13 16:53:39 +01:00
|
|
|
|
2024-02-05 22:35:28 +00:00
|
|
|
UPROPERTY(EditDefaultsOnly)
|
|
|
|
UAnimMontage* FireWeaponAnimMontage;
|
|
|
|
|
2024-01-04 15:50:15 +00:00
|
|
|
protected:
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
|
|
|
|
UNakatomiCMC* NakatomiCMC;
|
|
|
|
|
2022-12-13 04:11:56 +00:00
|
|
|
private:
|
|
|
|
UPROPERTY(VisibleDefaultsOnly)
|
|
|
|
UHealthComponent* HealthComponent = nullptr;
|
|
|
|
|
2023-02-09 21:56:52 +00:00
|
|
|
int CurrentInventorySlot = 0;
|
|
|
|
|
2023-09-13 16:53:39 +01:00
|
|
|
UPROPERTY(EditDefaultsOnly)
|
|
|
|
int MaximumThrowableInventorySize = 4;
|
|
|
|
|
2024-01-04 15:50:15 +00:00
|
|
|
|
2022-12-13 04:11:56 +00:00
|
|
|
public:
|
|
|
|
// Sets default values for this character's properties
|
2024-01-04 15:50:15 +00:00
|
|
|
ANakatomiCharacter(const FObjectInitializer& ObjectInitializer);
|
2022-12-13 04:11:56 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Called when the game starts or when spawned
|
|
|
|
virtual void BeginPlay() override;
|
|
|
|
|
2023-06-23 21:06:18 +01:00
|
|
|
public:
|
2022-12-13 04:11:56 +00: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);
|
2023-02-09 21:56:52 +00:00
|
|
|
|
|
|
|
void SetInventoryToDefault();
|
|
|
|
|
|
|
|
void SelectInventorySlot(int slot);
|
|
|
|
|
|
|
|
void InventoryIncrement();
|
|
|
|
|
|
|
|
void InventoryDecrement();
|
|
|
|
|
|
|
|
void AddWeaponToInventory(TSubclassOf<class AWeapon> weapon);
|
|
|
|
|
2023-02-12 20:33:08 +00:00
|
|
|
void AddWeaponToInventory(AWeapon* weapon);
|
|
|
|
|
2023-02-09 21:56:52 +00:00
|
|
|
void RemoveWeaponFromInventory(int i);
|
|
|
|
|
|
|
|
void RemoveWeaponFromInventory(AWeapon* weapon);
|
|
|
|
|
|
|
|
void RemoveCurrentWeaponFromInventory();
|
|
|
|
|
|
|
|
AWeapon* InitializeWeapon(TSubclassOf<class AWeapon> weapon);
|
|
|
|
|
|
|
|
AWeapon* GetCurrentWeapon();
|
|
|
|
|
|
|
|
void SetCurrentWeapon(AWeapon* weapon);
|
2023-02-12 20:33:08 +00:00
|
|
|
|
|
|
|
int GetCurrentInventorySlot();
|
2023-03-13 21:45:56 +00:00
|
|
|
|
2023-03-13 22:01:21 +00:00
|
|
|
virtual void OnFire();
|
|
|
|
|
2023-09-20 01:56:13 +01:00
|
|
|
TSubclassOf<AThrowable> PopThrowableFromInventory();
|
2023-09-13 16:53:39 +01:00
|
|
|
|
2023-09-20 01:56:13 +01:00
|
|
|
void PushThrowableToInventory(TSubclassOf<AThrowable> Throwable);
|
2023-09-13 16:53:39 +01:00
|
|
|
|
2024-01-04 20:31:33 +00:00
|
|
|
UNakatomiCMC* GetCharacterMovementComponent();
|
|
|
|
|
2024-02-05 21:36:44 +00:00
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
bool GetCrouched();
|
|
|
|
|
2023-03-13 21:56:23 +00:00
|
|
|
protected:
|
2023-03-13 21:45:56 +00:00
|
|
|
virtual void CalculateHits(TArray<FHitResult>* hits);
|
|
|
|
|
2023-03-13 21:56:23 +00:00
|
|
|
virtual void ProcessHits(TArray<FHitResult> hits);
|
2023-06-26 18:34:57 +01:00
|
|
|
|
2024-02-05 22:35:28 +00:00
|
|
|
virtual void PlayOnFireAnimations();
|
|
|
|
|
2023-06-26 18:34:57 +01:00
|
|
|
UFUNCTION()
|
|
|
|
virtual void OnDamaged();
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
virtual void OnDeath();
|
2022-12-13 04:11:56 +00:00
|
|
|
};
|