#include <EntityModel.h>
|
| | MovingEntityModel (float normalizedX, float normalizedY, float mapWidth, float mapHeight, float speed) |
| | Subclass of EntityModel to be used for any moving entity.
|
| Moves | getDirection () const |
| | Get the direction the entity is currently moving in.
|
| int | getGridX () const |
| int | getGridY () const |
| virtual void | move (const World &world, float dt)=0 |
| | Called within the World update loop and should update the position of the entity or handle moving the entity appropriately.
|
| virtual void | respawn ()=0 |
| | Called when an entity should respawn, this means it died and should be 'reset' to some extent.
|
| | EntityModel (float normalizedX, float normalizedY) |
| | Base class for entities.
|
| | ~EntityModel () override=default |
| float | getX () const |
| float | getY () const |
| virtual | ~Subject ()=default |
| void | attach (const std::shared_ptr< Observer > &observer) |
| | Attaches an observer to this Subject.
|
| void | notify (Events event) |
| | Call the Observer update function with the provided event.
|
|
| virtual bool | gridTargetReached (const World &world)=0 |
| | This function should be called when the MovingEntity has reached its targetX and targetY values (within a certain Epsilon).
|
| void | normalizeTarget () |
| | Normalizes the grid coordinates and stores these values in as target coordinates. Moving entities strive towards normalized grid coordinates.
|
◆ MovingEntityModel()
| MovingEntityModel::MovingEntityModel |
( |
float | normalizedX, |
|
|
float | normalizedY, |
|
|
float | mapWidth, |
|
|
float | mapHeight, |
|
|
float | speed ) |
Subclass of EntityModel to be used for any moving entity.
- Parameters
-
| normalizedX | Normalized initial X coordinate |
| normalizedY | Normalized initial Y coordinate |
| mapWidth | Map width (in tiles) |
| mapHeight | Map height (in tiles) |
| speed | Default speed of entity |
◆ getDirection()
| Moves MovingEntityModel::getDirection |
( |
| ) |
const |
|
nodiscard |
Get the direction the entity is currently moving in.
- Returns
- Current direction
◆ getGridX()
| int MovingEntityModel::getGridX |
( |
| ) |
const |
|
nodiscard |
- Returns
- Current grid aligned X coordinate
◆ getGridY()
| int MovingEntityModel::getGridY |
( |
| ) |
const |
|
nodiscard |
- Returns
- Current grid aligned Y coordinate
◆ gridTargetReached()
| virtual bool logic::MovingEntityModel::gridTargetReached |
( |
const World & | world | ) |
|
|
protectedpure virtual |
This function should be called when the MovingEntity has reached its targetX and targetY values (within a certain Epsilon).
- Parameters
-
- Returns
- Whether the entity continues down its current direction.
◆ move()
| virtual void logic::MovingEntityModel::move |
( |
const World & | world, |
|
|
float | dt ) |
|
pure virtual |
Called within the World update loop and should update the position of the entity or handle moving the entity appropriately.
- Parameters
-
| world | World |
| dt | Deltatime since last call |
Implemented in logic::GhostModel, and logic::PacmanModel.
◆ normalizeTarget()
| void MovingEntityModel::normalizeTarget |
( |
| ) |
|
|
protected |
Normalizes the grid coordinates and stores these values in as target coordinates. Moving entities strive towards normalized grid coordinates.
◆ respawn()
| virtual void logic::MovingEntityModel::respawn |
( |
| ) |
|
|
pure virtual |
◆ direction
◆ gridX
| int logic::MovingEntityModel::gridX |
|
protected |
◆ gridY
| int logic::MovingEntityModel::gridY |
|
protected |
◆ mapHeight
| float logic::MovingEntityModel::mapHeight |
|
protected |
◆ mapWidth
| float logic::MovingEntityModel::mapWidth |
|
protected |
◆ spawnX
| float logic::MovingEntityModel::spawnX |
|
protected |
◆ spawnY
| float logic::MovingEntityModel::spawnY |
|
protected |
◆ speed
| float logic::MovingEntityModel::speed |
|
protected |
◆ targetX
| float logic::MovingEntityModel::targetX |
|
protected |
◆ targetY
| float logic::MovingEntityModel::targetY |
|
protected |
The documentation for this class was generated from the following files: