fix repair problem
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
void startAnimRepair();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Repair")
|
||||
void repairStart();
|
||||
void repair();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Stamina")
|
||||
void staminaDecreace();
|
||||
|
||||
Reference in New Issue
Block a user