This commit is contained in:
Stefan Stefanov 2023-11-15 03:26:47 +02:00
parent f8cd10d74a
commit 85bc6c3dd9
3 changed files with 20 additions and 20 deletions

View file

@ -30,7 +30,6 @@ public:
void SetCurrentHeat(const double InCurrentHeat) { CurrentHeat = InCurrentHeat; } void SetCurrentHeat(const double InCurrentHeat) { CurrentHeat = InCurrentHeat; }
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UStaticMeshComponent> FireMesh; TObjectPtr<UStaticMeshComponent> FireMesh;
@ -48,6 +47,7 @@ public:
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default") UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default")
TObjectPtr<UCurveFloat> FireScaleCurveZ; TObjectPtr<UCurveFloat> FireScaleCurveZ;
private: private:
// [0.0, 1.0] // [0.0, 1.0]
double CurrentHeat{0.0}; double CurrentHeat{0.0};

View file

@ -3,10 +3,10 @@
#include "OvenPawn.h" #include "OvenPawn.h"
auto FCookstove::Setup(const UDataTable *DataTablePtr, const int32 MealID, bool FCookstove::Setup(const UDataTable *DataTablePtr, const int32 MealID,
const double InUndercookedMultiplier, const double InUndercookedMultiplier,
const double InOvercookedMultiplier, const double InOvercookedMultiplier,
const double InScoreMultiplier) -> bool const double InScoreMultiplier)
{ {
// Set the current meal id // Set the current meal id
CurrentMealID = MealID; CurrentMealID = MealID;
@ -29,7 +29,7 @@ auto FCookstove::Setup(const UDataTable *DataTablePtr, const int32 MealID,
return true; return true;
} }
auto FCookstove::GetMealFromTable(const UDataTable *DataTablePtr, const int32 MealID) -> FMeal FMeal FCookstove::GetMealFromTable(const UDataTable *DataTablePtr, const int32 MealID)
{ {
if (DataTablePtr == nullptr || MealID < 0) if (DataTablePtr == nullptr || MealID < 0)
{ {
@ -42,7 +42,7 @@ auto FCookstove::GetMealFromTable(const UDataTable *DataTablePtr, const int32 Me
return *Meal; return *Meal;
} }
auto FCookstove::SetCookingTime(const FTimespan CookingTimespan) -> void void FCookstove::SetCookingTime(const FTimespan CookingTimespan)
{ {
StartTime = FDateTime::Now(); StartTime = FDateTime::Now();
EndTime = StartTime + CookingTimespan; EndTime = StartTime + CookingTimespan;
@ -74,7 +74,7 @@ void FCookstove::Update(const float DeltaTime, int32 &PlayerScore)
} }
} }
auto FCookstove::GetRemainingCookingTime() const -> FTimespan FTimespan FCookstove::GetRemainingCookingTime() const
{ {
const FDateTime Now = FDateTime::Now(); const FDateTime Now = FDateTime::Now();
if (Now >= EndTime) if (Now >= EndTime)
@ -85,12 +85,12 @@ auto FCookstove::GetRemainingCookingTime() const -> FTimespan
return (EndTime - Now).GetTotalMilliseconds(); return (EndTime - Now).GetTotalMilliseconds();
} }
auto FCookstove::IsMealDone() const -> bool bool FCookstove::IsMealDone() const
{ {
return GetRemainingCookingTime() == 0.0; return GetRemainingCookingTime() == 0.0;
} }
auto FCookstove::FinishMeal() -> int32 int32 FCookstove::FinishMeal()
{ {
CookingStats.TotalCookedMeals++; CookingStats.TotalCookedMeals++;
CurrentlyCooking = false; CurrentlyCooking = false;
@ -183,7 +183,7 @@ bool AOvenPawn::TrySpawningNewRandomMeal()
return bSuccess; return bSuccess;
} }
auto AOvenPawn::RotateNeedleMouse(double MouseDeltaX) -> void void AOvenPawn::RotateNeedleMouse(double MouseDeltaX)
{ {
verifyf(ActiveDialIndex < CookspotDials.Num(), verifyf(ActiveDialIndex < CookspotDials.Num(),
TEXT( TEXT(
@ -204,7 +204,7 @@ auto AOvenPawn::RotateNeedleMouse(double MouseDeltaX) -> void
Dial.DialRatio = (Dial.MouseDeltaX + 1.0f) / 2.0; Dial.DialRatio = (Dial.MouseDeltaX + 1.0f) / 2.0;
} }
auto AOvenPawn::RotateNeedleController(const FVector2D ThumbstickLocation) -> void void AOvenPawn::RotateNeedleController(const FVector2D ThumbstickLocation)
{ {
verifyf(ActiveDialIndex < CookspotDials.Num(), verifyf(ActiveDialIndex < CookspotDials.Num(),
TEXT( TEXT(
@ -225,7 +225,7 @@ auto AOvenPawn::RotateNeedleController(const FVector2D ThumbstickLocation) -> vo
Dial.DialRatio = (Dial.DialRatioController + 1.0) / 2.0; Dial.DialRatio = (Dial.DialRatioController + 1.0) / 2.0;
} }
auto AOvenPawn::CycleActiveOvenDial(const bool CycleRight) -> void void AOvenPawn::CycleActiveOvenDial(const bool CycleRight)
{ {
if (CycleRight) if (CycleRight)
{ {

View file

@ -75,38 +75,38 @@ struct FCookstove
* @brief Given a @param DataTablePtr and a @param MealID, configure the cookstove to start cooking the meal. * @brief Given a @param DataTablePtr and a @param MealID, configure the cookstove to start cooking the meal.
* @return Returns whether we found a meal with the provided @param MealID and successfully started cooking it. * @return Returns whether we found a meal with the provided @param MealID and successfully started cooking it.
*/ */
auto Setup(const UDataTable *DataTablePtr, bool Setup(const UDataTable *DataTablePtr,
const int32 MealID, const int32 MealID,
const double InUndercookedMultiplier, const double InUndercookedMultiplier,
const double InOvercookedMultiplier, const double InOvercookedMultiplier,
const double InScoreMultiplier) -> bool; const double InScoreMultiplier);
static auto GetMealFromTable(const UDataTable *DataTablePtr, int32 MealID) -> FMeal; static FMeal GetMealFromTable(const UDataTable *DataTablePtr, int32 MealID);
auto SetCookingTime(const FTimespan CookingTimespan) -> void; void SetCookingTime(const FTimespan CookingTimespan);
/** /**
* @brief Updates the cookstove for this tick, if a meal is cooking, updates the stats for it and if it finishes it calculates the score, etc... * @brief Updates the cookstove for this tick, if a meal is cooking, updates the stats for it and if it finishes it calculates the score, etc...
* @param DeltaTime Time between N-1 and N-2 frames in milliseconds. * @param DeltaTime Time between N-1 and N-2 frames in milliseconds.
* @param PlayerScore Takes in the current player score in case a meal gets finished and the score must be returned. * @param PlayerScore Takes in the current player score in case a meal gets finished and the score must be returned.
*/ */
auto Update(const float DeltaTime, int32 &PlayerScore) -> void; void Update(const float DeltaTime, int32 &PlayerScore);
/** /**
* @brief Returns the remaining cooking time. * @brief Returns the remaining cooking time.
*/ */
auto GetRemainingCookingTime() const -> FTimespan; FTimespan GetRemainingCookingTime() const;
/** /**
* @brief Check if the currently cooked meal is done cooking. * @brief Check if the currently cooked meal is done cooking.
*/ */
auto IsMealDone() const -> bool; bool IsMealDone() const;
/** /**
* @brief Finishes up cooking the current meal, setting up the necessary stats and state. * @brief Finishes up cooking the current meal, setting up the necessary stats and state.
* @return Returns the calculated score based on the stats of the cooked meal. * @return Returns the calculated score based on the stats of the cooked meal.
*/ */
auto FinishMeal() -> int32; int32 FinishMeal();
}; };
@ -126,7 +126,7 @@ public:
virtual void SetupPlayerInputComponent(class UInputComponent *PlayerInputComponent) override; virtual void SetupPlayerInputComponent(class UInputComponent *PlayerInputComponent) override;
auto TrySpawningNewRandomMeal() -> bool; bool TrySpawningNewRandomMeal();
UFUNCTION(BlueprintCallable, Category="Oven Dials|Controlls") UFUNCTION(BlueprintCallable, Category="Oven Dials|Controlls")
void RotateNeedleMouse(double MouseDeltaX); void RotateNeedleMouse(double MouseDeltaX);