Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #pragma once
- #include "Engine.h"
- #include "ShooterTutorial.generated.h" // //without this you will get compile error after GENERATED_USTRUCT_BODY() - always add .generated.h
- UENUM(BlueprintType) //"BlueprintType" is essential to include so you can create this enum in Blueprints.
- 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.
- {
- ET_Robots UMETA(DisplayName = "Robots"),
- ET_Humans UMETA(DisplayName = "Humans"),
- ET_Aliens UMETA(DisplayName = "Aliens")
- };
- UENUM(BlueprintType) //"BlueprintType" is essential to include so you can create this enum in Blueprints.
- enum class ELevelDifficulty : uint8 // This enum will hold level difficulty displayed in level selection screen.
- {
- LD_Easy UMETA(DisplayName = "Easy"),
- LD_Medium UMETA(DisplayName = "Medium"),
- LD_Hard UMETA(DisplayName = "Hard")
- };
- USTRUCT(BlueprintType) //again BlueprintType means you can use this structure in Blueprints.
- struct FLevelData //name of structure - need start with 'F' this structure will hold level data which will be displayed in level selection screen.
- {
- GENERATED_USTRUCT_BODY() // without this you will get compile errors
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data") // this means you can break structure in blueprints + it will be replicated. //Always use UPROPERTY() macro in variables.
- ELevelEnemyType EnemiesType; // declaring ELevelEnemy Enum in ELevelData structure.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- ELevelDifficulty LevelDifficulty;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- float LevelTime; // levels will be time based that's why we need to declare how long we can play before end of the level.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- float HiScore; // we will store HiScore in this structure so it can be seen in level selection screen.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- UObject* SequenceData; // reference to Object which will store sequence of enemies for the level.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- UMaterial* LevelIcon;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- UMaterial* LevelBackground;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
- FString LevelToLoad; //name of the level to load.
- //Constructor
- FLevelData()
- {
- //Always initialize your USTRUCT variables!
- // exception is if you know the variable type has its own default constructor
- EnemiesType = ELevelEnemyType::ET_Robots;
- LevelDifficulty = ELevelDifficulty::LD_Easy;
- LevelTime = 120.0f;
- HiScore = 0.0f;
- SequenceData = NULL; //means clear reference
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement