Guest User

Untitled

a guest
Nov 2nd, 2015
340
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "Engine.h"
  6. #include "ShooterTutorial.generated.h" //  //without this you will get compile error after GENERATED_USTRUCT_BODY() - always add .generated.h
  7.  
  8. UENUM(BlueprintType)        //"BlueprintType" is essential to include so you can create this enum in Blueprints.
  9. enum class ELevelEnemyType : uint8   // Name of Enum. Need starts with 'E'. This enum will hold type of enemies inside the level. Just as information in level selection screen.
  10. {
  11.     ET_Robots   UMETA(DisplayName = "Robots"),
  12.     ET_Humans   UMETA(DisplayName = "Humans"),
  13.     ET_Aliens   UMETA(DisplayName = "Aliens")
  14. };
  15.  
  16. UENUM(BlueprintType)        //"BlueprintType" is essential to include so you can create this enum in Blueprints.
  17. enum class ELevelDifficulty : uint8  // This enum will hold level difficulty displayed in level selection screen.
  18. {
  19.     LD_Easy     UMETA(DisplayName = "Easy"),
  20.     LD_Medium   UMETA(DisplayName = "Medium"),
  21.     LD_Hard     UMETA(DisplayName = "Hard")
  22. };
  23.  
  24.  
  25. USTRUCT(BlueprintType)  //again BlueprintType means you can use this structure in Blueprints.
  26. struct FLevelData   //name of structure - need start with 'F' this structure will hold level data which will be displayed in level selection screen.
  27. {
  28.     GENERATED_USTRUCT_BODY()  // without this you will get compile errors
  29.  
  30.         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")  // this means you can break structure in blueprints + it will be replicated. //Always use UPROPERTY() macro in variables.
  31.         ELevelEnemyType EnemiesType;  // declaring ELevelEnemy Enum in ELevelData structure.
  32.  
  33.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  34.         ELevelDifficulty LevelDifficulty;
  35.  
  36.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  37.         float LevelTime;   // levels will be time based that's why we need to declare how long we can play before end of the level.
  38.  
  39.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  40.         float HiScore;     // we will store HiScore in this structure so it can be seen in level selection screen.
  41.  
  42.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  43.         UObject* SequenceData; // reference to Object which will store sequence of enemies for the level.
  44.  
  45.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  46.         UMaterial* LevelIcon;
  47.  
  48.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  49.         UMaterial* LevelBackground;
  50.  
  51.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
  52.         FString LevelToLoad; //name of the level to load.
  53.  
  54.     //Constructor
  55.     FLevelData()
  56.     {
  57.         //Always initialize your USTRUCT variables!
  58.         //   exception is if you know the variable type has its own default constructor
  59.         EnemiesType = ELevelEnemyType::ET_Robots;
  60.         LevelDifficulty = ELevelDifficulty::LD_Easy;
  61.         LevelTime = 120.0f;
  62.         HiScore = 0.0f;
  63.         SequenceData = NULL; //means clear reference
  64.     }
  65. };
RAW Paste Data