RpgGame
Console Based RPG game in C#
Loading...
Searching...
No Matches
RpgGame.Generation.MapSpawnHelper Class Reference

Provides common item-spawning routines that can be shared among multiple IMapGenerator implementations. More...

Collaboration diagram for RpgGame.Generation.MapSpawnHelper:

Static Public Member Functions

static Task SpawnItemsAsync< TItem > (Level level, int count, Func< TItem > factory)
 Asynchronously places a number of items at random walkable locations on the given level.
 
static Task SpawnCoinsAsync (Level level, int count)
 Convenience wrapper that spawns coins.
 
static Task SpawnSwordAsync (Level level, int count)
 Convenience wrapper that spawns one-handed swords.
 
static Task SpawnDoubleSwordAsync (Level level, int count)
 Convenience wrapper that spawns two-handed swords.
 
static Task SpawnGoldAsync (Level level, int count)
 Convenience wrapper that spawns gold piles.
 
static Task SpawnPotionsAsync (Level level, int count)
 Convenience wrapper that spawns potions.
 
static Task SpawnThornsAsync (Level level, int count)
 Conveniece wrapper that spawns Thorns.
 

Detailed Description

Provides common item-spawning routines that can be shared among multiple IMapGenerator implementations.

The helpers choose random walkable positions on the map and place the requested items there. By centralizing the logic here, generators don't have to duplicate the same loops and checks over and over.

Member Function Documentation

◆ SpawnCoinsAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnCoinsAsync ( Level  level,
int  count 
)
static

Convenience wrapper that spawns coins.

Parameters
level
count
Here is the caller graph for this function:

◆ SpawnDoubleSwordAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnDoubleSwordAsync ( Level  level,
int  count 
)
static

Convenience wrapper that spawns two-handed swords.

Parameters
level
count
Here is the caller graph for this function:

◆ SpawnGoldAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnGoldAsync ( Level  level,
int  count 
)
static

Convenience wrapper that spawns gold piles.

Parameters
level
count
Returns
Here is the caller graph for this function:

◆ SpawnItemsAsync< TItem >()

static Task RpgGame.Generation.MapSpawnHelper.SpawnItemsAsync< TItem > ( Level  level,
int  count,
Func< TItem >  factory 
)
inlinestatic

Asynchronously places a number of items at random walkable locations on the given level.

Template Parameters
TItemThe concrete Item type.
Parameters
levelLevel instance to populate.
countTotal number of items to spawn.
factoryFunction that returns a fresh item instance.
Returns
A task that completes when all items have been placed.

The placement logic executes on the thread pool because the work is CPU-bound; callers can await the returned task without blocking the caller thread.

Type Constraints
TItem :IItem 
Here is the call graph for this function:

◆ SpawnPotionsAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnPotionsAsync ( Level  level,
int  count 
)
static

Convenience wrapper that spawns potions.

Parameters
level
count
Returns
Here is the caller graph for this function:

◆ SpawnSwordAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnSwordAsync ( Level  level,
int  count 
)
static

Convenience wrapper that spawns one-handed swords.

Parameters
level
count
Here is the caller graph for this function:

◆ SpawnThornsAsync()

static Task RpgGame.Generation.MapSpawnHelper.SpawnThornsAsync ( Level  level,
int  count 
)
static

Conveniece wrapper that spawns Thorns.

Parameters
level
count
Returns
Here is the caller graph for this function:

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