Bugfix Clicking Instantly Activates Combat
This commit is contained in:
parent
e91d059c56
commit
0de2753dff
BIN
Content/BlueprintAI/AI/AIBruh.uasset
(Stored with Git LFS)
BIN
Content/BlueprintAI/AI/AIBruh.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/BlueprintAI/AI/BTT_ChaseBruh.uasset
(Stored with Git LFS)
BIN
Content/BlueprintAI/AI/BTT_ChaseBruh.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Top_layer_level.umap
(Stored with Git LFS)
BIN
Content/Levels/Top_layer_level.umap
(Stored with Git LFS)
Binary file not shown.
@ -37,17 +37,22 @@ void UHoldToInitCombat::TickComponent(float DeltaTime, ELevelTick TickType, FAct
|
|||||||
{
|
{
|
||||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
//If the player is holding down the right mouse button for 3 seconds, then the player will enter combat mode
|
// //If the player is holding down the right mouse button for 3 seconds, then the player will enter combat mode
|
||||||
if (bRightClickDown && RightClickDownTime < 0.1f)
|
// if (bRightClickDown && RightClickDownTime < 0.1f)
|
||||||
|
// {
|
||||||
|
// RightClickDownTime += DeltaTime;
|
||||||
|
// }
|
||||||
|
// else if (bRightClickDown && RightClickDownTime >= 0.1f)
|
||||||
|
// {
|
||||||
|
// //Enter Combat Mode
|
||||||
|
// Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->StartCombat(TargetEnemy);
|
||||||
|
// //UBlackboardComponent* TargetEnemyBlackboard = Cast<UBlackboardComponent>(TargetEnemy->GetComponentByClass(UBlackboardComponent::StaticClass()));
|
||||||
|
// //TargetEnemyBlackboard->SetValueAsBool("IsInCombat", true);
|
||||||
|
// OnRightClickUp();
|
||||||
|
// }
|
||||||
|
if (bRightClickDown)
|
||||||
{
|
{
|
||||||
RightClickDownTime += DeltaTime;
|
|
||||||
}
|
|
||||||
else if (bRightClickDown && RightClickDownTime >= 0.1f)
|
|
||||||
{
|
|
||||||
//Enter Combat Mode
|
|
||||||
Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->StartCombat(TargetEnemy);
|
Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->StartCombat(TargetEnemy);
|
||||||
//UBlackboardComponent* TargetEnemyBlackboard = Cast<UBlackboardComponent>(TargetEnemy->GetComponentByClass(UBlackboardComponent::StaticClass()));
|
|
||||||
//TargetEnemyBlackboard->SetValueAsBool("IsInCombat", true);
|
|
||||||
OnRightClickUp();
|
OnRightClickUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +63,7 @@ void UHoldToInitCombat::OnRightClickDown()
|
|||||||
{
|
{
|
||||||
TargetEnemy = RightClickHit;
|
TargetEnemy = RightClickHit;
|
||||||
bRightClickDown = true;
|
bRightClickDown = true;
|
||||||
InitCombatWidget->AddToViewport();
|
//InitCombatWidget->AddToViewport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +73,7 @@ void UHoldToInitCombat::OnRightClickUp()
|
|||||||
RightClickDownTime = 0.0f;
|
RightClickDownTime = 0.0f;
|
||||||
if (InitCombatWidget->IsInViewport())
|
if (InitCombatWidget->IsInViewport())
|
||||||
{
|
{
|
||||||
InitCombatWidget->RemoveFromViewport();
|
InitCombatWidget->RemoveFromParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +91,10 @@ AActor* UHoldToInitCombat::LookingAtEnemy() const
|
|||||||
return HitResult.GetActor();
|
return HitResult.GetActor();
|
||||||
}
|
}
|
||||||
if (HitResult.GetActor()->Tags.Contains("Break"))
|
if (HitResult.GetActor()->Tags.Contains("Break"))
|
||||||
{
|
{
|
||||||
HitResult.GetActor()->Destroy();
|
HitResult.GetActor()->Destroy();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f);
|
DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user