fix repair problem

This commit is contained in:
2020-07-23 18:26:49 +05:00
parent 7c332a47fb
commit 885b887193
6 changed files with 10 additions and 7 deletions
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -46,7 +46,8 @@ void ABaseItem::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherA
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
UE_LOG(LogTemp, Warning, TEXT("ITEM -> ENDOverlapBegin"));
//female = nullptr;
female = nullptr;
used = false;
}
@@ -89,7 +90,6 @@ void ABaseItem::EndUseItem()
{
Health -= use;
}
used = false;
}
@@ -103,7 +103,7 @@ bool ABaseItem::isCrushed()
void ABaseItem::showBroken()
{
used = false;
}
+6 -3
View File
@@ -144,11 +144,14 @@ void APlayerCharacter::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor*
void APlayerCharacter::OnRepair()
{
if (!isPlayAnimRepair && crushedItem != nullptr && crushedItem->getHealth() < crushedItem->getMaxHealth())
if (!isPlayAnimRepair &&
crushedItem != nullptr &&
!crushedItem->used &&
crushedItem->getHealth() < crushedItem->getMaxHealth())
{
isPlayAnimRepair = !isPlayAnimRepair;
crushedItem->used = true;
staminaDecreace();
repairStart();
startAnimRepair();
}
@@ -190,7 +193,7 @@ void APlayerCharacter::Tick(float DeltaTime)
// Called to bind functionality to input
void APlayerCharacter::repairStart()
void APlayerCharacter::repair()
{
crushedItem->healing();
}
+1 -1
View File
@@ -99,7 +99,7 @@ public:
void startAnimRepair();
UFUNCTION(BlueprintCallable, Category = "Repair")
void repairStart();
void repair();
UFUNCTION(BlueprintCallable, Category = "Stamina")
void staminaDecreace();