Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
#include "GameFramework/Actor.h"
#include "Types/CavrnusSpaceConnection.h"
#include "FlagActor.generated.h"

UCLASS()
class MODULE_API AFlagActor : public AActor
{
  GENERATED_BODY()
  
public:
  void InitializeProperties(FString& InContainerName, FCavrnusSpaceConnection& InSpaceConnection);
  
private:
  UPROPERTY()
  LinearColor FlagColor;
  
  UPROPERTY()
  float FlagHeight;
  
  // Objects that synchronize properties should be created using UCavrnusFunctionLibrary::SpawnObject. This gives the spawner back the properties container name that this object will use in the journal.
  FString ContainerName;
  
  FCavrnusSpaceConnection SpaceConnection;
};

FlagActor.cpp

Code Block
languagecpp
#include "FlagActor.h"
#include "CavrnusFunctionLibrary.h"

void AFlagActor::InitializeProperties(FString& InContainerName, FCavrnusSpaceConnection& InSpaceConnection)
{
  ContainerName = InContainerName;
  SpaceConnection = InSpaceConnection;
  
  UCavrnusFunctionLibrary::DefineColorPropertyDefaultValue(InSpaceConnection, InContainerName, "FlagColor", FlagColor);
  UCavrnusFunctionLibrary::DefineFloatPropertyDefaultValue(InSpaceConnection, InContainerName, "FlagHeight", FlagHeight);
}