interactables, game state
This commit is contained in:
@ -3,3 +3,15 @@
|
||||
|
||||
#include "HYGameStateBase.h"
|
||||
|
||||
AHYGameStateBase::AHYGameStateBase()
|
||||
{
|
||||
static ConstructorHelpers::FObjectFinder<UDataTable> BP_ItemDataTable(
|
||||
TEXT("DataTable'/Game/Data/ItemDataTable.ItemDataTable'"));
|
||||
|
||||
ItemDatabase = BP_ItemDataTable.Object;
|
||||
}
|
||||
|
||||
UDataTable* AHYGameStateBase::GetItemDatabase() const
|
||||
{
|
||||
return ItemDatabase;
|
||||
}
|
||||
|
@ -2,16 +2,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine.h"
|
||||
#include "GameFramework/GameStateBase.h"
|
||||
#include "HYGameStateBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* The game state holds the database for all existing items within the game.
|
||||
*/
|
||||
UCLASS()
|
||||
class HWANYOUNG2_API AHYGameStateBase : public AGameStateBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AHYGameStateBase();
|
||||
|
||||
//getter function for item database
|
||||
UDataTable* GetItemDatabase() const;
|
||||
|
||||
protected:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
class UDataTable* ItemDatabase;
|
||||
};
|
||||
|
27
hwanyoung2/Source/hwanyoung2/HYInteractableActor.cpp
Normal file
27
hwanyoung2/Source/hwanyoung2/HYInteractableActor.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "HYInteractableActor.h"
|
||||
|
||||
// Sets default values
|
||||
AHYInteractableActor::AHYInteractableActor()
|
||||
{
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AHYInteractableActor::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AHYInteractableActor::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
26
hwanyoung2/Source/hwanyoung2/HYInteractableActor.h
Normal file
26
hwanyoung2/Source/hwanyoung2/HYInteractableActor.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "HYInteractableActor.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class HWANYOUNG2_API AHYInteractableActor : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AHYInteractableActor();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
};
|
Reference in New Issue
Block a user