Guest User

Untitled

a guest
Nov 2nd, 2015
310
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USTRUCT(BlueprintType)  //again BlueprintType means you can use this structure in Blueprints.
  2. struct FLevelData   //name of structure - need start with 'F' this structure will hold level data which will be displayed in level selection screen.
  3. {
  4.     GENERATED_USTRUCT_BODY()  // without this you will get compile errors
  5.  
  6.         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")  // this means you can break structure in blueprints + it will be replicated. //Always use UPROPERTY() macro in variables.
  7.         ELevelEnemyType EnemiesType;  // declaring ELevelEnemy Enum in ELevelData structure.
  8.  
  9.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  10.         ELevelDifficulty LevelDifficulty;
  11.  
  12.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  13.         float LevelTime;   // levels will be time based that's why we need to declare how long we can play before end of the level.
  14.  
  15.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  16.         float HiScore;     // we will store HiScore in this structure so it can be seen in level selection screen.
  17.  
  18.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  19.         UObject* SequenceData; // reference to Object which will store sequence of enemies for the level.
  20.  
  21.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  22.         UMaterial* LevelIcon;
  23.  
  24.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  25.         UMaterial* LevelBackground;
  26.  
  27.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  28.         FString LevelToLoad; //name of the level to load.
  29.  
  30.     //Constructor
  31.     FLevelData()
  32.     {
  33.         //Always initialize your USTRUCT variables!
  34.         //   exception is if you know the variable type has its own default constructor
  35.         EnemiesType = ELevelEnemyType::ET_Robots;
  36.         LevelDifficulty = ELevelDifficulty::LD_Easy;
  37.         LevelTime = 120.0f;
  38.         HiScore = 0.0f;
  39.         SequenceData = NULL; //means clear reference
  40.     }
  41. };
RAW Paste Data