diff --git a/Content/CombatSystem/Blueprints/Actor/BP_ToughSword.uasset b/Content/CombatSystem/Blueprints/Actor/BP_ToughSword.uasset index 13183055..244a5f64 100644 Binary files a/Content/CombatSystem/Blueprints/Actor/BP_ToughSword.uasset and b/Content/CombatSystem/Blueprints/Actor/BP_ToughSword.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/ContinueAttack_AN.uasset b/Content/CombatSystem/Blueprints/Animnotifies/ContinueAttack_AN.uasset new file mode 100644 index 00000000..1301bd9a Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/ContinueAttack_AN.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/ResetAttack_AN.uasset b/Content/CombatSystem/Blueprints/Animnotifies/ResetAttack_AN.uasset new file mode 100644 index 00000000..2202f3bd Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/ResetAttack_AN.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/ResetCombat_AN.uasset b/Content/CombatSystem/Blueprints/Animnotifies/ResetCombat_AN.uasset new file mode 100644 index 00000000..f78a7920 Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/ResetCombat_AN.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/RotateCharacter_ANS.uasset b/Content/CombatSystem/Blueprints/Animnotifies/RotateCharacter_ANS.uasset new file mode 100644 index 00000000..3115967d Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/RotateCharacter_ANS.uasset differ diff --git a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset index 2fa8e308..be2604fa 100644 Binary files a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset and b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling.uasset b/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling.uasset index 3b9a03e4..bc5515b6 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling.uasset and b/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling_Montage.uasset new file mode 100644 index 00000000..056132bb Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/Dodge/Rolling_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDisarm_Anim_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDisarm_Anim_Montage.uasset index 02c84e93..876c2ead 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDisarm_Anim_Montage.uasset and b/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDisarm_Anim_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDraw_Anim_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDraw_Anim_Montage.uasset index 0395897e..0748c161 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDraw_Anim_Montage.uasset and b/Content/CombatSystem/CourseFiles/Animations/LightSword/Equip/LightWeaponDraw_Anim_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01.uasset index 5ed52950..b374d6b9 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01.uasset and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01_Montage.uasset new file mode 100644 index 00000000..d6feab3a Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack01_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02.uasset index b85b6b1f..285bac3d 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02.uasset and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02_Montage.uasset new file mode 100644 index 00000000..f247c687 Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack02_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03.uasset index 97abfbdc..eedc3cf0 100644 Binary files a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03.uasset and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03_Montage.uasset new file mode 100644 index 00000000..49b2753f Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/LightSword/LightAttack/LightAttack03_Montage.uasset differ diff --git a/Content/CombatSystem/Input/Actions/IA_Assist.uasset b/Content/CombatSystem/Input/Actions/IA_Assist.uasset new file mode 100644 index 00000000..080cdc2d Binary files /dev/null and b/Content/CombatSystem/Input/Actions/IA_Assist.uasset differ diff --git a/Content/CombatSystem/Input/Actions/IA_Dodge.uasset b/Content/CombatSystem/Input/Actions/IA_Dodge.uasset new file mode 100644 index 00000000..9e93b390 Binary files /dev/null and b/Content/CombatSystem/Input/Actions/IA_Dodge.uasset differ diff --git a/Content/CombatSystem/Input/Actions/IA_LightAttack.uasset b/Content/CombatSystem/Input/Actions/IA_LightAttack.uasset new file mode 100644 index 00000000..be64f5bc Binary files /dev/null and b/Content/CombatSystem/Input/Actions/IA_LightAttack.uasset differ diff --git a/Content/CombatSystem/Input/IMC_Default.uasset b/Content/CombatSystem/Input/IMC_Default.uasset index fab1a265..84d10454 100644 Binary files a/Content/CombatSystem/Input/IMC_Default.uasset and b/Content/CombatSystem/Input/IMC_Default.uasset differ diff --git a/Source/D1/Actor/BaseWeapon.cpp b/Source/D1/Actor/BaseWeapon.cpp index a83eb258..17b21fea 100644 --- a/Source/D1/Actor/BaseWeapon.cpp +++ b/Source/D1/Actor/BaseWeapon.cpp @@ -4,7 +4,6 @@ #include "Actor/BaseWeapon.h" #include "Components/CombatComponent.h" #include "GameFramework/Character.h" -#include "Animation/CombatAnimInstance.h" ABaseWeapon::ABaseWeapon() { @@ -30,5 +29,4 @@ void ABaseWeapon::OnEquipped() UCombatAnimInstance* animInstance = Cast(character->GetMesh()->GetAnimInstance()); animInstance->UpdateCombatType(CombatType); } - } diff --git a/Source/D1/Actor/BaseWeapon.h b/Source/D1/Actor/BaseWeapon.h index 6e0903dc..f32d3c5a 100644 --- a/Source/D1/Actor/BaseWeapon.h +++ b/Source/D1/Actor/BaseWeapon.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "Actor/BaseEquippable.h" #include "Enums/CombatType.h" +#include "Animation/CombatAnimInstance.h" #include "BaseWeapon.generated.h" /** @@ -26,6 +27,9 @@ public: public: FORCEINLINE UAnimMontage* GetEnterCombat() const { return EnterCombat; } FORCEINLINE UAnimMontage* GetExitCombat() const { return ExitCombat; } + FORCEINLINE TArray& GetAttackMontage() { return AttackMontage; } + FORCEINLINE TArray& GetDodgeMontage() { return DodgeMontage; } + protected: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization") FName HandSocketName; @@ -35,8 +39,12 @@ protected: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components") TObjectPtr CombatComponent; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Animations") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Montages") TObjectPtr EnterCombat; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Animations") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Montages") TObjectPtr ExitCombat; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Montages") + TArray> AttackMontage; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Montages") + TArray> DodgeMontage; }; diff --git a/Source/D1/Actor/PickupActor.cpp b/Source/D1/Actor/PickupActor.cpp index d87e2e07..758642f0 100644 --- a/Source/D1/Actor/PickupActor.cpp +++ b/Source/D1/Actor/PickupActor.cpp @@ -32,8 +32,8 @@ void APickupActor::Interact(AActor* Caller) FActorSpawnParameters spawnParam; spawnParam.Owner = Caller; spawnParam.Instigator = pawn; - ABaseEquippable* SpawnItem = Cast(GetWorld()->SpawnActor(Item, &GetActorTransform(),spawnParam)); - if(SpawnItem) + ABaseEquippable* SpawnItem = Cast(GetWorld()->SpawnActor(Item, &GetActorTransform(), spawnParam)); + if (SpawnItem) SpawnItem->OnEquipped(); } } diff --git a/Source/D1/CombatCharacter.cpp b/Source/D1/CombatCharacter.cpp index a02762f5..db2899c6 100644 --- a/Source/D1/CombatCharacter.cpp +++ b/Source/D1/CombatCharacter.cpp @@ -10,9 +10,10 @@ #include "EnhancedInputComponent.h" #include "EnhancedInputSubsystems.h" #include "Kismet/KismetSystemLibrary.h" +#include "Kismet/KismetMathLibrary.h" #include "Interface/Interact.h" #include "Actor/BaseWeapon.h" -#include "Components//CombatComponent.h" +#include "Components/CombatComponent.h" ////////////////////////////////////////////////////////////////////////// // ACombatCharacter @@ -55,6 +56,10 @@ ACombatCharacter::ACombatCharacter() // are set in the derived blueprint asset named ThirdPersonCharacter (to avoid direct content references in C++) CombatComponent = CreateDefaultSubobject(TEXT("CombatComponent")); + + CombatEnabled = false; + IsTogglingCombat = false; + IsDodge = false; } void ACombatCharacter::BeginPlay() @@ -70,6 +75,45 @@ void ACombatCharacter::BeginPlay() Subsystem->AddMappingContext(DefaultMappingContext, 0); } } + + //Player¿¡ ¹«±â¸¦ óÀ½ºÎÅÍ µé°íÀÖ°ÔÇÔ. ¾Æ¸¶µµ ÀÓ½ÃÄÚµå + FActorSpawnParameters spawnParam; + spawnParam.Owner = this; + spawnParam.Instigator = this; + ABaseEquippable* SpawnItem = Cast(GetWorld()->SpawnActor(Weapon, &GetActorTransform(), spawnParam)); + if (SpawnItem) + SpawnItem->OnEquipped(); +} + +void ACombatCharacter::ContinueAttack_Implementation() +{ + CombatComponent->SetIsAttacking(false); + if (CombatComponent->GetIsAttackSaved()) + { + CombatComponent->SetIsAttackSaved(false); + AttackEvent(); + } +} + +void ACombatCharacter::ResetAttack_Implementation() +{ + CombatComponent->ResetAttack(); +} + +void ACombatCharacter::ResetCombat_Implementation() +{ + CombatComponent->ResetAttack(); + IsTogglingCombat = false; + IsDodge = false; +} + +FRotator ACombatCharacter::GetDesiredRotation_Implementation() +{ + FVector InputVector = GetCharacterMovement()->GetLastInputVector(); + if (InputVector.Equals(FVector(0, 0, 0), 0.001f)) + return GetActorRotation(); + else + return UKismetMathLibrary::MakeRotFromX(GetLastMovementInputVector()); } ////////////////////////////////////////////////////////////////////////// @@ -95,6 +139,12 @@ void ACombatCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerIn //ToggleCombat EnhancedInputComponent->BindAction(ToggleCombatAction, ETriggerEvent::Started, this, &ACombatCharacter::ToggleCombat); + + //LightAttack + EnhancedInputComponent->BindAction(LightAttackAction, ETriggerEvent::Started, this, &ACombatCharacter::LightAttack); + + //Dodge + EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &ACombatCharacter::Dodge); } } @@ -168,17 +218,110 @@ void ACombatCharacter::ToggleCombat(const FInputActionValue& Value) { bool bInput = Value.Get(); + ToggleCombatEvent(); +} + +void ACombatCharacter::LightAttack(const FInputActionValue& Value) +{ + if (CombatComponent->GetIsAttacking()) + CombatComponent->SetIsAttackSaved(true); + else + AttackEvent(); +} + +void ACombatCharacter::Dodge(const FInputActionValue& Value) +{ + if (CanPerformDodge()) + PerformDodge(); +} + +void ACombatCharacter::ToggleCombatEvent() +{ ABaseWeapon* baseWeapon = CombatComponent->GetMainWeapon(); if (!baseWeapon) return; - - bool isCombatEnabled = CombatComponent->GetCombatEnabled(); - if (!isCombatEnabled) + + if (!CanPerformToggleCombat()) + return; + + if (!CombatComponent->GetCombatEnabled()) PlayAnimMontage(baseWeapon->GetEnterCombat()); else PlayAnimMontage(baseWeapon->GetExitCombat()); } +void ACombatCharacter::AttackEvent() +{ + if (!CanPerformAttack()) + return; + + if (CombatComponent->GetCombatEnabled()) + PerformAttack(CombatComponent->GetAttackCount()); + else + ToggleCombatEvent(); +} + +void ACombatCharacter::PerformAttack(int32 attackIndex) +{ + ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon(); + if (!CurrentWeapon) + return; + if (!CurrentWeapon->GetAttackMontage().IsValidIndex(attackIndex)) + return; + UAnimMontage* attackMontage = CurrentWeapon->GetAttackMontage()[attackIndex]; + if(!IsValid(attackMontage)) + return; + + CombatComponent->SetIsAttacking(true); + PlayAnimMontage(attackMontage); + + int idx = attackIndex + 1; + if (idx > CurrentWeapon->GetAttackMontage().Num()) + idx = 0; + + CombatComponent->SetAttackCount(idx); +} + +//ÀÎÀÚ°ªÀº ³ªÁß¿¡ ÇÊ¿äÇϸé Ãß°¡ PerformDodge(int32 dodgeIndex) +void ACombatCharacter::PerformDodge() +{ + ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon(); + if (!CurrentWeapon) + return; + int32 montageIndex = 0; + TArray montages = CurrentWeapon->GetDodgeMontage(); + if (montages.Num() > montageIndex) + montageIndex = 0; + if (!montages.IsValidIndex(montageIndex)) + return; + + UAnimMontage* dodgeMontage = CurrentWeapon->GetDodgeMontage()[montageIndex]; + if (IsValid(dodgeMontage)) + { + IsDodge = true; + PlayAnimMontage(dodgeMontage); + } + else + { + FString str = FString::Printf(TEXT("Dodge Index %n is NOT VALID!!"), montageIndex); + GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Blue, str); + } +} + +bool ACombatCharacter::CanPerformToggleCombat() +{ + return (!CombatComponent->GetIsAttacking() && !IsTogglingCombat); +} + +bool ACombatCharacter::CanPerformAttack() +{ + return (!CombatComponent->GetIsAttacking() && !IsTogglingCombat); +} + +bool ACombatCharacter::CanPerformDodge() +{ + return (!CombatComponent->GetIsAttacking() && !IsTogglingCombat && !IsDodge); +} diff --git a/Source/D1/CombatCharacter.h b/Source/D1/CombatCharacter.h index 5cd78b2c..c9a7d67b 100644 --- a/Source/D1/CombatCharacter.h +++ b/Source/D1/CombatCharacter.h @@ -5,11 +5,12 @@ #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 +class ACombatCharacter : public ACharacter, public ICombatInterface { GENERATED_BODY() @@ -44,33 +45,71 @@ class ACombatCharacter : public ACharacter /* 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(); -protected: - /** Called for movement input */ - void Move(const FInputActionValue& Value); - - /** Called for looking input */ - void Look(const FInputActionValue& Value); - - void Interact(const FInputActionValue& Value); - void ToggleCombat(const FInputActionValue& Value); -protected: - // APawn interface - virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; - - // To add mapping context - virtual void BeginPlay(); - 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(); + +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; +protected: + /** Called for movement input */ + void Move(const FInputActionValue& Value); + + /** Called for looking input */ + 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 PerformAttack(int32 attackIndex); + void PerformDodge(); + + bool CanPerformToggleCombat(); + bool CanPerformAttack(); + bool CanPerformDodge(); public: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true")) TObjectPtr CombatComponent; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon", meta = (AllowPrivateAccess = "true")) + TSubclassOf Weapon; + +private: + bool CombatEnabled; + bool IsTogglingCombat; + bool IsDodge; }; diff --git a/Source/D1/Components/CombatComponent.cpp b/Source/D1/Components/CombatComponent.cpp index cf90e8bd..d9670b94 100644 --- a/Source/D1/Components/CombatComponent.cpp +++ b/Source/D1/Components/CombatComponent.cpp @@ -30,9 +30,11 @@ void UCombatComponent::SetCombatEnabled(bool bInputCombat) } } -bool UCombatComponent::GetCombatEnabled() +void UCombatComponent::ResetAttack() { - return bCombatEnabled; + AttackCount = 0; + bIsAttackSaved = false; + bIsAttacking = false; } void UCombatComponent::SetMainWeapon(ABaseWeapon* NewWeapon) @@ -44,4 +46,10 @@ void UCombatComponent::SetMainWeapon(ABaseWeapon* NewWeapon) } MainWeapon = NewWeapon; -} \ No newline at end of file +} + +ABaseWeapon* UCombatComponent::GetMainWeapon() const +{ + return MainWeapon; +} + diff --git a/Source/D1/Components/CombatComponent.h b/Source/D1/Components/CombatComponent.h index 1d3dc500..eb956a9f 100644 --- a/Source/D1/Components/CombatComponent.h +++ b/Source/D1/Components/CombatComponent.h @@ -21,15 +21,36 @@ public: UFUNCTION(BlueprintCallable) void SetCombatEnabled(bool bInputCombat); UFUNCTION(BlueprintCallable) - bool GetCombatEnabled(); + FORCEINLINE bool GetCombatEnabled() { return bCombatEnabled; } +public: + void ResetAttack(); +public: void SetMainWeapon(ABaseWeapon* NewWeapon); - FORCEINLINE ABaseWeapon* GetMainWeapon() const { return MainWeapon; } - + FORCEINLINE ABaseWeapon* GetMainWeapon() const; + + FORCEINLINE void SetIsAttacking(bool attacking) { bIsAttacking = attacking; } + FORCEINLINE bool GetIsAttacking() const { return bIsAttacking; } + + FORCEINLINE void SetIsAttackSaved(bool attackSaved) { bIsAttackSaved = attackSaved; } + FORCEINLINE bool GetIsAttackSaved() const { return bIsAttackSaved; } + + FORCEINLINE void SetAttackCount(int32 count) { AttackCount = count; } + FORCEINLINE int32 GetAttackCount() { return AttackCount; } + private: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true")) TObjectPtr MainWeapon; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true")) bool bCombatEnabled; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true")) + bool bIsAttackSaved; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true")) + bool bIsAttacking; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true")) + int32 AttackCount; }; diff --git a/Source/D1/Interface/CombatInterface.cpp b/Source/D1/Interface/CombatInterface.cpp new file mode 100644 index 00000000..5b109d07 --- /dev/null +++ b/Source/D1/Interface/CombatInterface.cpp @@ -0,0 +1,6 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Interface/CombatInterface.h" + +// Add default functionality here for any ICombatInterface functions that are not pure virtual. diff --git a/Source/D1/Interface/CombatInterface.h b/Source/D1/Interface/CombatInterface.h new file mode 100644 index 00000000..ca62828a --- /dev/null +++ b/Source/D1/Interface/CombatInterface.h @@ -0,0 +1,33 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/Interface.h" +#include "CombatInterface.generated.h" + +// This class does not need to be modified. +UINTERFACE(MinimalAPI) +class UCombatInterface : public UInterface +{ + GENERATED_BODY() +}; + +/** + * + */ +class D1_API ICombatInterface +{ + GENERATED_BODY() + + // Add interface functions to this class. This is the class that will be inherited to implement this interface. +public: + UFUNCTION(BlueprintCallable, BlueprintNativeEvent) + void ContinueAttack(); + UFUNCTION(BlueprintCallable, BlueprintNativeEvent) + void ResetAttack(); + UFUNCTION(BlueprintCallable, BlueprintNativeEvent) + void ResetCombat(); + UFUNCTION(BlueprintCallable, BlueprintNativeEvent) + FRotator GetDesiredRotation(); +};