Space Plunder
Loading...
Searching...
No Matches
FDungeonSpawns Struct Reference

#include <DungeonData.h>

Public Member Functions

TArray< FDungeonSpawnRoomGetAllRooms () const
 
TArray< FDungeonSpawnRoom > & GetRooms ()
 
TArray< FDungeonSpawnRoomGetRoomsOfType (const TSubclassOf< AActor > ActorClass)
 
TArray< FDungeonSpawnRoomGetRoomsWithExits () const
 
TArray< FDungeonSpawnRoomGetRoomsWithNoExits () const
 
TArray< FDungeonSpawnRoomGetRoomsWithNumOfExits (const int32 MinExits) const
 
TArray< FDungeonSpawnRoomGetRoomsWithNumOfExits (const int32 MinExits, const int32 MaxExits) const
 
FDungeonSpawnRoomFind (const TSubclassOf< AActor > ActorClass)
 
EDungeonRoomType FindType (const TSubclassOf< AActor > ActorClass) const
 
bool IsEmpty () const
 
bool IsValidIndex (const int32 Index) const
 
int32 Num () const
 
 FDungeonSpawns ()
 
 FDungeonSpawns (const TArray< FDungeonSpawnRoom > &InitialRooms)
 

Protected Attributes

TArray< FDungeonSpawnRoomRooms
 

Constructor & Destructor Documentation

◆ FDungeonSpawns() [1/2]

FDungeonSpawns::FDungeonSpawns ( )
inline
280 {
281
282 }

◆ FDungeonSpawns() [2/2]

FDungeonSpawns::FDungeonSpawns ( const TArray< FDungeonSpawnRoom > & InitialRooms)
inlineexplicit
284 {
285 Rooms = InitialRooms;
286 }
TArray< FDungeonSpawnRoom > Rooms
Definition DungeonData.h:291

Member Function Documentation

◆ Find()

FDungeonSpawnRoom * FDungeonSpawns::Find ( const TSubclassOf< AActor > ActorClass)
inline
243 {
244 for(auto& Room : Rooms)
245 {
246 if(Room.Type == ActorClass)
247 {
248 return &Room;
249 }
250 }
251 return nullptr;
252 }

◆ FindType()

EDungeonRoomType FDungeonSpawns::FindType ( const TSubclassOf< AActor > ActorClass) const
inline
254 {
255 for(auto& Room : Rooms)
256 {
257 if(Room.Type == ActorClass)
258 {
259 return Room.CalculatedType;
260 }
261 }
262 return EDungeonRoomType::Hallway;
263 }

◆ GetAllRooms()

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetAllRooms ( ) const
inline
176 {
177 return GetRoomsWithNumOfExits(0);
178 }
TArray< FDungeonSpawnRoom > GetRoomsWithNumOfExits(const int32 MinExits) const
Definition DungeonData.h:212

◆ GetRooms()

TArray< FDungeonSpawnRoom > & FDungeonSpawns::GetRooms ( )
inline
181 {
182 return Rooms;
183 }

◆ GetRoomsOfType()

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetRoomsOfType ( const TSubclassOf< AActor > ActorClass)
inline
186 {
187 TArray<FDungeonSpawnRoom> SelectedRooms;
188 for(auto& Room : Rooms)
189 {
190 if(Room.Type == ActorClass)
191 {
192 SelectedRooms.Add(Room);
193 }
194 }
195 return SelectedRooms;
196 }

◆ GetRoomsWithExits()

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetRoomsWithExits ( ) const
inline
202 {
203 return GetRoomsWithNumOfExits(1);
204 }

◆ GetRoomsWithNoExits()

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetRoomsWithNoExits ( ) const
inline
207 {
208 return GetRoomsWithNumOfExits(0, 0);
209 }

◆ GetRoomsWithNumOfExits() [1/2]

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetRoomsWithNumOfExits ( const int32 MinExits) const
inline
213 {
214 TArray<FDungeonSpawnRoom> SelectedRooms;
215 for(int32 i = 0; i < Rooms.Num(); ++i)
216 {
217 if(Rooms[i].IsValid() == false){UE_LOG(LogDungeonData, Warning, TEXT("FDungeonSpawns::GetRoomsWithNumOfExits Room %i Not Valid"), i);continue;}
218 // UE_LOG(LogDungeonData, Warning, TEXT("Rooms %s GetExits: %i"), *Rooms[i].Type->GetName(), Rooms[i].GetExits());
219 if(Rooms[i].GetExits() >= MinExits)
220 {
221 SelectedRooms.AddUnique(Rooms[i]);
222 }
223 }
224 return SelectedRooms;
225 }

◆ GetRoomsWithNumOfExits() [2/2]

TArray< FDungeonSpawnRoom > FDungeonSpawns::GetRoomsWithNumOfExits ( const int32 MinExits,
const int32 MaxExits ) const
inline
227 {
228 TArray<FDungeonSpawnRoom> SelectedRooms;
229 for(int32 i = 0; i < Rooms.Num(); ++i)
230 {
231 if(Rooms[i].IsValid() == false){UE_LOG(LogDungeonData, Warning, TEXT("FDungeonSpawns::GetRoomsWithNumOfExits Room %i Not Valid"), i);continue;}
232 // if(Rooms[i].GetExits() >= MinExits && Rooms[i].GetExits() <= MaxExits)
233 if(Rooms[i].GetExits() >= MinExits && Rooms[i].GetExits() <= MaxExits)
234 {
235 // This needs to add the room with weights
236 SelectedRooms.AddUnique(Rooms[i]);
237 }
238 }
239 return SelectedRooms;
240 }

◆ IsEmpty()

bool FDungeonSpawns::IsEmpty ( ) const
inline
267 {
268 return Rooms.IsEmpty();
269 }

◆ IsValidIndex()

bool FDungeonSpawns::IsValidIndex ( const int32 Index) const
inline
271 {
272 return Rooms.IsValidIndex(Index);
273 }

◆ Num()

int32 FDungeonSpawns::Num ( ) const
inline
275 {
276 return Rooms.Num();
277 }

Member Data Documentation

◆ Rooms

TArray<FDungeonSpawnRoom> FDungeonSpawns::Rooms
protected

The documentation for this struct was generated from the following file: