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"
|
2024-01-11 20:21:15 +01:00
|
|
|
#include "Nakatomi.h"
|
2023-09-13 17:53:39 +02:00
|
|
|
#include "Throwable.h"
|
2023-02-09 22:56:52 +01:00
|
|
|
#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;
|
|
|
|
|
2023-02-09 22:56:52 +01:00
|
|
|
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;
|
2023-09-13 17:53:39 +02:00
|
|
|
|
2024-02-05 23:35:28 +01:00
|
|
|
UPROPERTY(EditDefaultsOnly)
|
|
|
|
UAnimMontage* FireWeaponAnimMontage;
|
|
|
|
|
2024-01-04 16:50:15 +01:00
|
|
|
protected:
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
|
|
|
|
UNakatomiCMC* NakatomiCMC;
|
|
|
|
|
2022-12-13 05:11:56 +01:00
|
|
|
private:
|
|
|
|
UPROPERTY(VisibleDefaultsOnly)
|
|
|
|
UHealthComponent* HealthComponent = nullptr;
|
|
|
|
|
2023-02-09 22:56:52 +01:00
|
|
|
int CurrentInventorySlot = 0;
|
|
|
|
|
2023-09-13 17:53:39 +02:00
|
|
|
UPROPERTY(EditDefaultsOnly)
|
|
|
|
int MaximumThrowableInventorySize = 4;
|
|
|
|
|
2024-01-04 16:50:15 +01:00
|
|
|
|
2022-12-13 05:11:56 +01:00
|
|
|
public:
|
|
|
|
// Sets default values for this character's properties
|
2024-01-04 16:50:15 +01:00
|
|
|
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);
|
2023-02-09 22:56:52 +01:00
|
|
|
|
|
|
|
void SetInventoryToDefault();
|
|
|
|
|
|
|
|
void SelectInventorySlot(int slot);
|
|
|
|
|
|
|
|
void InventoryIncrement();
|
|
|
|
|
|
|
|
void InventoryDecrement();
|
|
|
|
|
|
|
|
void AddWeaponToInventory(TSubclassOf<class AWeapon> weapon);
|
|
|
|
|
2023-02-12 21:33:08 +01:00
|
|
|
void AddWeaponToInventory(AWeapon* weapon);
|
|
|
|
|
2023-02-09 22:56:52 +01: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 21:33:08 +01:00
|
|
|
|
|
|
|
int GetCurrentInventorySlot();
|
2023-03-13 22:45:56 +01:00
|
|
|
|
2023-03-13 23:01:21 +01:00
|
|
|
virtual void OnFire();
|
|
|
|
|
2023-09-20 02:56:13 +02:00
|
|
|
TSubclassOf<AThrowable> PopThrowableFromInventory();
|
2023-09-13 17:53:39 +02:00
|
|
|
|
2023-09-20 02:56:13 +02:00
|
|
|
void PushThrowableToInventory(TSubclassOf<AThrowable> Throwable);
|
2023-09-13 17:53:39 +02:00
|
|
|
|
2024-01-04 21:31:33 +01:00
|
|
|
UNakatomiCMC* GetCharacterMovementComponent();
|
|
|
|
|
2024-02-05 22:36:44 +01:00
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
bool GetCrouched();
|
|
|
|
|
2023-03-13 22:56:23 +01:00
|
|
|
protected:
|
2023-03-13 22:45:56 +01:00
|
|
|
virtual void CalculateHits(TArray<FHitResult>* hits);
|
|
|
|
|
2023-03-13 22:56:23 +01:00
|
|
|
virtual void ProcessHits(TArray<FHitResult> hits);
|
2023-06-26 19:34:57 +02:00
|
|
|
|
2024-02-05 23:35:28 +01:00
|
|
|
virtual void PlayOnFireAnimations();
|
|
|
|
|
2023-06-26 19:34:57 +02:00
|
|
|
UFUNCTION()
|
|
|
|
virtual void OnDamaged();
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
virtual void OnDeath();
|
2022-12-13 05:11:56 +01:00
|
|
|
};
|