Added new dials to the oven, added material for the fire with offset

Migrated some assets from another repo, added new float curves and actions.

Created new material with twinkling over time and gradient color.

Added knobs and button needles to the oven
This commit is contained in:
Stefan Stefanov 2023-11-15 00:27:10 +02:00
parent b800f29c3e
commit b01e9b5891
26 changed files with 35 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -20,6 +20,20 @@ AOvenCookspot::AOvenCookspot()
CookpotMesh->SetupAttachment(RootComponent);
}
void AOvenCookspot::UpdateFire(const float DeltaTime) const
{
if (FireScaleCurveXY && FireScaleCurveZ && FireMesh)
{
const float ScaleXY = FireScaleCurveXY->GetFloatValue(CurrentHeat);
const float ScaleZ = FireScaleCurveZ->GetFloatValue(CurrentHeat);
FireMesh->SetWorldScale3D(FVector(ScaleXY, ScaleXY, ScaleZ));
}
else
{
UE_LOG(LogTemp, Error, TEXT("FireScaleCurveXY, FireScaleCurveZ or FireMesh is null"));
}
}
// Called when the game starts or when spawned
void AOvenCookspot::BeginPlay()
{
@ -28,8 +42,9 @@ void AOvenCookspot::BeginPlay()
}
// Called every frame
void AOvenCookspot::Tick(float DeltaTime)
void AOvenCookspot::Tick(const float DeltaTime)
{
Super::Tick(DeltaTime);
UpdateFire(DeltaTime);
}

View file

@ -15,6 +15,9 @@ public:
// Sets default values for this actor's properties
AOvenCookspot();
UFUNCTION(BlueprintCallable, Category = "Cookspot")
void UpdateFire(const float DeltaTime) const;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
@ -24,8 +27,6 @@ public:
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<USceneComponent> RootComp;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UStaticMeshComponent> FireMesh;
@ -35,4 +36,13 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UStaticMeshComponent> CookpotMesh;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default")
TObjectPtr<UCurveFloat> FireScaleCurveXY;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default")
TObjectPtr<UCurveFloat> FireScaleCurveZ;
private:
// [0.0, 1.0]
double CurrentHeat;
};

View file

@ -112,6 +112,9 @@ void AOvenPawn::BeginPlay()
{
Super::BeginPlay();
Cookstoves.AddDefaulted(CookspotLocations.Num());
size_t CookspotIdx{0};
for (const AActor *CookspotLoc : CookspotLocations)
{
FActorSpawnParameters SpawnParameters;
@ -120,11 +123,9 @@ void AOvenPawn::BeginPlay()
CookspotLoc->GetTransform(),
SpawnParameters);
OvenCookspotActor->SetActorLocation(CookspotLoc->GetActorLocation());
CookstoveObjects.Add(OvenCookspotActor);
Cookstoves[CookspotIdx].OvenCookstoveActor = OvenCookspotActor;
CookspotIdx++;
}
// Setup the cookstove related items
Cookstoves.AddDefaulted(CookspotLocations.Num());
checkf(Cookstoves.Num() == CookstoveObjects.Num(), TEXT("Cookstoves and CookstoveObjects have different sizes"))
}
void AOvenPawn::Tick(float DeltaTime)

View file

@ -69,6 +69,8 @@ struct FCookstove
FCookingStats CookingStats{};
TObjectPtr<AOvenCookspot> OvenCookstoveActor;
/**
* @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.
@ -151,6 +153,5 @@ public:
private:
// An array of all the cookstoves, from left to right on the screen.
TArray<TObjectPtr<AOvenCookspot>> CookstoveObjects;
TArray<FCookstove> Cookstoves;
};