>>...Code Sample.... Unreal Engine Struct And Enum Example

//-----------------------------------------------------------------------------------------------------------------
// Spawner States    -- Enum                                                                                      -
//-----------------------------------------------------------------------------------------------------------------
UENUM()
enum class ESpawnerState : uint8
{
    Random,
    Trail,
    EveryOther
};

//-----------------------------------------------------------------------------------------------------------------
// Spawner Struct                                                                                                 -
//-----------------------------------------------------------------------------------------------------------------
USTRUCT(BlueprintType)
struct FSpawnerInformation
{
    GENERATED_USTRUCT_BODY()

    // -- Private -- Struct information
private:
    UPROPERTY()
    ESpawnerState state;

    UPROPERTY()
    TArray<FVector> lastUsedLocations;

    UPROPERTY()
    int32 spawnCount;

    // -- Public -- Accessors, Mutators, Other methods, and constuctor
public:
    /*
     * Takes a state to change the spawner to
     * @Param  The state that the spawner should be changed to
     */
    void setState(ESpawnerState inState)
    {
        state = inState;
    }
        
    /*
     * Adds a Vector to the struct's array
     * @Param The Vector in which to add to the array    
     */
    void addLocation(FVector loc)
    {
        if (lastUsedLocations.Num() > 10)
        {
            lastUsedLocations.RemoveAt(0);
            lastUsedLocations.Add(loc);
        }
        else
            lastUsedLocations.Add(loc);    
    }

    /*
     * Changes the number of Spawn Count
     * @Param Number to change the spawn count to
     */
    void setSpawnCount(int32 in)
    {
        spawnCount = in;
    }

    /*
     * Returns the state of the spawners behavior
     * @Return the current state of the spawner
     */
    ESpawnerState getState()
    {
        return state;
    }

    /*
     * @Param Takes in a position to return
     * @Return The Vector at a given Position    
     */
    FVector getLocation(int32 pos)
    {
        return lastUsedLocations[pos];    
    }
    
    /*
     * Returns the current count of how many times a spawn method has been called
     * Since the last time it switched.
     * @Return the int32 value of many times a metod was called     
     */
    int32 getCount()
    {
        return spawnCount;    
    }

    /*
     * Returns the array's logical size
     * @Returns the arrays size + 1
     */
    int32 getArraySize()
    {
        return lastUsedLocations.Num();
    }

    /*
     * Checks for an exact x in the array using a linear search
     * Note: This Method was never used and was later removed.  
     * @Returns If an X was found
     */
    bool isXInArray(float x)
    {
        bool flag = false;            

        return flag;
    }

    /*
     * Destroyes the objects to Gives the Memory back to the system      
     */
    void destroy()
    {
        lastUsedLocations.~TArray();
    }

    // -- Default Constructor
    FSpawnerInformation()
    {
        state = ESpawnerState::Random;
        spawnCount = 0;
        lastUsedLocations.SetNum(0);
    }
};