Skip to content

Commit

Permalink
Screen, market
Browse files Browse the repository at this point in the history
#4 #5
메인 모니터 메뉴 탭
생산물 테이블 생성, 가공물 테이블 변경
거래소에 생산물 테이블 내용 기반 UI 항목 생성
버튼 누를 시 화폐 소모, 구매한 물건 스폰

+가구 설치 버그 수정
  • Loading branch information
Cytochrome8942 committed Apr 22, 2022
1 parent 1b70208 commit fa410ab
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 27 deletions.
Binary file modified Unreal 5.0/Content/SmartFactoryBP/BP_AnimalIncubator.uasset
Binary file not shown.
Binary file modified Unreal 5.0/Content/SmartFactoryBP/BP_PlantIncubator.uasset
Binary file not shown.
Binary file modified Unreal 5.0/Content/SmartFactoryBP/BP_PlayerCharacter.uasset
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 modified Unreal 5.0/Content/SmartFactoryBP/Panel/BP_3DPanel_UMG.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Unreal 5.0/Content/SmartFactoryBP/SmartFactoryMap.umap
Binary file not shown.
9 changes: 0 additions & 9 deletions Unreal 5.0/Source/Unreal/DataTableRow.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "DataTableRow.h"

// Sets default values
ADataTableRow::ADataTableRow()
{
// 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;

}
23 changes: 17 additions & 6 deletions Unreal 5.0/Source/Unreal/DataTableRow.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
*/
USTRUCT(BlueprintType)
struct FCommodityRow : public FTableRowBase
struct FProductRow : public FTableRowBase
{
GENERATED_BODY()

Expand All @@ -28,13 +28,24 @@ struct FCommodityRow : public FTableRowBase
UStaticMesh* FinalModel;
};

USTRUCT(BlueprintType)
struct FHoldableObjectRow : public FTableRowBase
{
GENERATED_BODY()

public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UBlueprintGeneratedClass* Object;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* Image;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Price;
};

UCLASS()
class UNREAL_API ADataTableRow : public AActor
{
GENERATED_BODY()

public:
// Sets default values for this actor's properties
ADataTableRow();

};
4 changes: 4 additions & 0 deletions Unreal 5.0/Source/Unreal/HoldableObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ FString UHoldableObject::GetName() {
return Name;
}

int32 UHoldableObject::GetPrice() {
return Price;
}

4 changes: 4 additions & 0 deletions Unreal 5.0/Source/Unreal/HoldableObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ class UNREAL_API UHoldableObject : public UActorComponent
public:
int32 GetWeight(void);

UFUNCTION(BlueprintCallable)
FString GetName();

UFUNCTION(BlueprintCallable)
int32 GetPrice();

protected:
UPROPERTY(EditAnywhere)
FString Name;
Expand Down
2 changes: 1 addition & 1 deletion Unreal 5.0/Source/Unreal/Incubator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void UIncubator::PutCommodity(AActor* CommodityRef) {

CommodityGrowthDuration = GrowingCommodityRef->GetGrowthTime();
StartGrowingTime = Cast<USmartFactoryGameInstance>(GetWorld()->GetGameInstance())->GetGameTime();
ResultRow = CommodityTable->FindRow<FCommodityRow>(*GrowingCommodityRef->GetName(), "");
ResultRow = CommodityTable->FindRow<FProductRow>(*GrowingCommodityRef->GetName(), "");

if (ResultRow == nullptr) {
UE_LOG(LogTemp, Warning, TEXT("Table Error"));
Expand Down
2 changes: 1 addition & 1 deletion Unreal 5.0/Source/Unreal/Incubator.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class UNREAL_API UIncubator : public UActorComponent
UCommodity* GrowingCommodityRef;
int32 CommodityGrowthDuration;

FCommodityRow* ResultRow;
FProductRow* ResultRow;

FDateTime StartGrowingTime;

Expand Down
2 changes: 1 addition & 1 deletion Unreal 5.0/Source/Unreal/PlayerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
APlayerCharacter::APlayerCharacter()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(55.f, 15.f);
GetCapsuleComponent()->InitCapsuleSize(90.f, 15.f);

PlayerCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("PlayerCamera"));
PlayerCamera->SetupAttachment(GetCapsuleComponent());
Expand Down
1 change: 1 addition & 0 deletions Unreal 5.0/Source/Unreal/PlayerHand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void UPlayerHand::Hold(AActor* Target) {
if (auto TargetKit = Target->FindComponentByClass<UFurnatureKit>()) {
TargetKit->SpawnHologram();
PlayerCharacterRef->FindComponentByClass<UPlayerLineTrace>()->bIsConstructing = true;
SetRightHand();
}
}

Expand Down
12 changes: 9 additions & 3 deletions Unreal 5.0/Source/Unreal/PlayerInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,32 @@ void UPlayerInteraction::TickComponent(float DeltaTime, ELevelTick TickType, FAc
// Check if player can construct and change GUI. [LSH]
void UPlayerInteraction::IsConstructable() {
FHitResult Hit = PlayerLineTraceRef->GetHitResult();
bIsHit = true;
bIsHit = false;
if (Hit.GetActor()) {
bIsHit = true;
if (Hit.GetActor()->ActorHasTag("Floor")) {
PlayerHandRef->SetRightHand();
PlayerHandRef->GetRightHand()->FindComponentByClass<UFurnatureKit>()
->SetHologramPosition(Hit.Location, PlayerLineTraceRef->GetPlayerRotation());
bIsInteractable = true;
}
else {
PlayerHandRef->GetRightHand()->FindComponentByClass<UFurnatureKit>()
->SetHologramPosition(FVector(0., -1000., 0.), PlayerLineTraceRef->GetPlayerRotation());
bIsInteractable = false;
}
}
else {

Hit = PlayerLineTraceRef->ForceLineTraceObject();

if (Hit.GetActor()) {
bIsHit = true;
// TODO : Check dust chute : change interactable to true
}

PlayerHandRef->GetRightHand()->FindComponentByClass<UFurnatureKit>()
->SetHologramPosition(FVector(0., -1000., 0.), PlayerLineTraceRef->GetPlayerRotation());
PlayerHandRef->ResetSwapValues();

bIsInteractable = false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Unreal 5.0/Source/Unreal/PlayerLineTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
UPlayerLineTrace::UPlayerLineTrace()
{
PrimaryComponentTick.bCanEverTick = true;
LineTraceObject = new LineTraceObjectStrategy(GetOwner(), GetWorld());
LineTraceFloor = new LineTraceFloorStrategy(GetOwner(), GetWorld());
}

void UPlayerLineTrace::BeginPlay()
{
Super::BeginPlay();

LineTraceObject = new LineTraceObjectStrategy(GetOwner(), GetWorld());
LineTraceFloor = new LineTraceFloorStrategy(GetOwner(), GetWorld());
ActiveLineTrace = LineTraceObject;
}

Expand Down
5 changes: 5 additions & 0 deletions Unreal 5.0/Source/Unreal/SmartFactoryGameInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include "SmartFactoryGameInstance.h"

void USmartFactoryGameInstance::CurrencyChange(int32 Amount) {
Currency += Amount;
CurrencyDelegate.Broadcast(Currency);
}

FDateTime USmartFactoryGameInstance::GetGameTime(void) {
return GameTime;
}
12 changes: 8 additions & 4 deletions Unreal 5.0/Source/Unreal/SmartFactoryGameInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
#include "Engine/GameInstance.h"
#include "SmartFactoryGameInstance.generated.h"

/**
*
*/

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCheckTimeDelegate, FDateTime, CurrentTime);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCurrencySpendDelegate, int32, Currency);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FNightDelegate);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FMorningDelegate);

Expand All @@ -30,8 +27,12 @@ class UNREAL_API USmartFactoryGameInstance : public UGameInstance
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bIsNight;

UFUNCTION(BlueprintCallable)
FDateTime GetGameTime();

UFUNCTION(BlueprintCallable)
void CurrencyChange(int32 Amount);

UPROPERTY(BlueprintAssignable, VisibleAnywhere, BlueprintCallable, Category = "Event")
FCheckTimeDelegate CheckTimeDelegate;

Expand All @@ -40,4 +41,7 @@ class UNREAL_API USmartFactoryGameInstance : public UGameInstance

UPROPERTY(BlueprintAssignable, VisibleAnywhere, BlueprintCallable, Category = "Event")
FMorningDelegate MorningDelegate;

UPROPERTY(BlueprintAssignable, VisibleAnywhere, BlueprintCallable, Category = "Event")
FCurrencySpendDelegate CurrencyDelegate;
};

0 comments on commit fa410ab

Please sign in to comment.