Add campfire cooking placeholder
This commit is contained in:
@@ -36,6 +36,11 @@ void AAgrarianCampfire::Tick(float DeltaSeconds)
|
||||
SetLit(false);
|
||||
}
|
||||
|
||||
if (CanCook())
|
||||
{
|
||||
CookingProgressSeconds = FMath::Min(CookingSecondsRequired, CookingProgressSeconds + DeltaSeconds);
|
||||
}
|
||||
|
||||
WarmNearbyCharacters(DeltaSeconds);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +50,9 @@ void AAgrarianCampfire::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Ou
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
DOREPLIFETIME(AAgrarianCampfire, bLit);
|
||||
DOREPLIFETIME(AAgrarianCampfire, FuelSeconds);
|
||||
DOREPLIFETIME(AAgrarianCampfire, bCookingPlaceholderEnabled);
|
||||
DOREPLIFETIME(AAgrarianCampfire, CookingSecondsRequired);
|
||||
DOREPLIFETIME(AAgrarianCampfire, CookingProgressSeconds);
|
||||
}
|
||||
|
||||
FText AAgrarianCampfire::GetInteractionText_Implementation(const AAgrarianGameCharacter* Interactor) const
|
||||
@@ -96,6 +104,21 @@ void AAgrarianCampfire::Extinguish()
|
||||
}
|
||||
}
|
||||
|
||||
bool AAgrarianCampfire::CanCook() const
|
||||
{
|
||||
return bLit && bCookingPlaceholderEnabled && CookingSecondsRequired > 0.0f;
|
||||
}
|
||||
|
||||
float AAgrarianCampfire::GetCookingProgressRatio() const
|
||||
{
|
||||
if (CookingSecondsRequired <= 0.0f)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return FMath::Clamp(CookingProgressSeconds / CookingSecondsRequired, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void AAgrarianCampfire::OnRep_FireState()
|
||||
{
|
||||
UpdateVisualState();
|
||||
|
||||
Reference in New Issue
Block a user