Added a cookspot class for creating prefabs in BP
This commit is contained in:
parent
25e85ebf6f
commit
1fa1a725b3
3 changed files with 76 additions and 6 deletions
32
Source/minicook/OvenCookspot.cpp
Normal file
32
Source/minicook/OvenCookspot.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Stefan Stefanov 2023
|
||||
|
||||
|
||||
#include "OvenCookspot.h"
|
||||
|
||||
// Sets default values
|
||||
AOvenCookspot::AOvenCookspot()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
FireMesh = CreateDefaultSubobject<UStaticMeshComponent>("FireSM");
|
||||
FireMesh->SetupAttachment(RootComponent);
|
||||
FireElementMesh = CreateDefaultSubobject<UStaticMeshComponent>("FireElementSM");
|
||||
FireElementMesh->SetupAttachment(RootComponent);
|
||||
CookpotMesh = CreateDefaultSubobject<UStaticMeshComponent>("CookpotSM");
|
||||
CookpotMesh->SetupAttachment(RootComponent);
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AOvenCookspot::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AOvenCookspot::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
35
Source/minicook/OvenCookspot.h
Normal file
35
Source/minicook/OvenCookspot.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Stefan Stefanov 2023
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "OvenCookspot.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class MINICOOK_API AOvenCookspot : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AOvenCookspot();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<UStaticMeshComponent> FireMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<UStaticMeshComponent> FireElementMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<UStaticMeshComponent> CookpotMesh;
|
||||
};
|
||||
|
|
@ -33,7 +33,8 @@ public:
|
|||
))
|
||||
double HeatHalfRange{0.1};
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Meal", meta=(Tooltip = "The total cooking time for this meal recipe, in milliseconds"))
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Meal",
|
||||
meta=(Tooltip = "The total cooking time for this meal recipe, in milliseconds"))
|
||||
double TotalCookingTimeMS{5000.0};
|
||||
};
|
||||
|
||||
|
|
@ -138,13 +139,15 @@ public:
|
|||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Oven Settings")
|
||||
int32 CurrentPlayerScore{0};
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<AActor> CookstovePrefab;
|
||||
|
||||
// ReSharper disable once CppUE4ProbableMemoryIssuesWithUObject
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<UDataTable> RecipesDataTable;
|
||||
|
||||
private:
|
||||
// An array of all the cookstoves, from left to right on the screen
|
||||
TArray<TObjectPtr<AActor>> CookstoveObjects;
|
||||
TArray<FCookstove> Cookstoves;
|
||||
|
||||
public:
|
||||
// ReSharper disable once CppUE4ProbableMemoryIssuesWithUObject
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Oven Settings")
|
||||
TObjectPtr<UDataTable> RecipesDataTable;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue