D1/Source/D1/CombatCharacter.h

134 lines
4.5 KiB
C++
Raw Blame History

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "InputActionValue.h"
#include "Interface/CombatInterface.h"
#include "CombatCharacter.generated.h"
UCLASS(config=Game)
class ACombatCharacter : public ACharacter, public ICombatInterface
{
GENERATED_BODY()
/** Camera boom positioning the camera behind the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class USpringArmComponent* CameraBoom;
/** Follow camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class UCameraComponent* FollowCamera;
/** MappingContext */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* DefaultMappingContext;
/** Jump Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* JumpAction;
/** Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* MoveAction;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LookAction;
/* Interact Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* InteractAction;
/* ToggleCombat Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* ToggleCombatAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LightAttackAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* DodgeAction;
public:
ACombatCharacter();
public:
/** Returns CameraBoom subobject **/
FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
/** Returns FollowCamera subobject **/
FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
protected:
// APawn interface
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
virtual void BeginPlay() override;
virtual float TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override;
public:
// Inherited via ICombatInterface
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ContinueAttack();
virtual void ContinueAttack_Implementation() override;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ResetAttack();
virtual void ResetAttack_Implementation() override;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ResetCombat();
virtual void ResetCombat_Implementation() override;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
FRotator GetDesiredRotation();
virtual FRotator GetDesiredRotation_Implementation() override;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
bool CanReceiveDamage();
virtual bool CanReceiveDamage_Implementation() override;
protected:
//Input Funcs
void Move(const FInputActionValue& Value);
void Look(const FInputActionValue& Value);
void Interact(const FInputActionValue& Value);
void ToggleCombat(const FInputActionValue& Value);
void LightAttack(const FInputActionValue& Value);
void Dodge(const FInputActionValue& Value);
private:
void ToggleCombatEvent();
void AttackEvent();
void CharacterTakeDamage(float InDamage);
void ApplyHitReactionPhysicsVelocity(float InitialSpeed);
void EnableRagdoll();
void PerformAttack(int32 attackIndex);
void PerformDodge();
void PerformDeath();
bool CanPerformToggleCombat();
bool CanPerformAttack();
bool CanPerformDodge();
bool CanJumping();
public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
TObjectPtr<class UCombatComponent> CombatComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon", meta = (AllowPrivateAccess = "true"))
TSubclassOf<class ABaseEquippable> Weapon;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
FName PelvisBoneName;
private:
//TODO : particle, sound <20>߰<EFBFBD>
//class USoundWave* HitSound;
TObjectPtr<UAnimMontage> HitMontage;
private:
bool CombatEnabled;
bool IsTogglingCombat;
bool IsDodge;
bool IsDisabled;
bool IsDead;
float Health;
};