Unreal Snake Game 1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SnakeGame::Game Class Reference

Public Member Functions

 Game (const Settings &settings, const IPositionRandomizerPtr &randomizer=MakeShared< PositionRandomizer >())
 
TSharedPtr< Gridgrid () const
 
TSharedPtr< Snakesnake () const
 
TSharedPtr< Foodfood () const
 
void update (float deltaSeconds, const Input &input)
 
uint32 score () const
 
float gameTime () const
 
void subscribeOnGameplayEvent (GameplayEventCallback callback)
 

Private Member Functions

void updateGrid ()
 
bool updateTime (float deltaSeconds)
 
bool died (const Position &prevTailPosition) const
 
void generateFood ()
 
bool foodTaken () const
 
FORCEINLINE void dispatchEvent (GameplayEvent Event)
 

Private Attributes

const Settings c_settings
 
TSharedPtr< Gridm_grid
 
TSharedPtr< Snakem_snake
 
TSharedPtr< Foodm_food
 
float m_moveSeconds {0.0f}
 
bool m_gameOver {false}
 
uint32 m_score {0}
 
float m_gameTime {0.0f}
 
TArray< GameplayEventCallback > m_gameplayEventCallbacks
 

Member Function Documentation

◆ food()

TSharedPtr< Food > SnakeGame::Game::food ( ) const
inline

Returns the pointer to the food object

Returns
TSharedPtr<Food> pointer to the food object

◆ grid()

TSharedPtr< Grid > SnakeGame::Game::grid ( ) const
inline

Returns the pointer to the grid object

Returns
TSharedPtr<Grid> pointer to the grid object

◆ snake()

TSharedPtr< Snake > SnakeGame::Game::snake ( ) const
inline

Returns the pointer to the snake object

Returns
TSharedPtr<Snake> pointer to the snake object

◆ update()

void Game::update ( float  deltaSeconds,
const Input input 
)

Updates game

Parameters
deltaSecondsdelta time
inputuser input

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