Represents a generic unit in the simulation.
More...
#include <Unit.hpp>
|
| | Unit (size_t id, const std::shared_ptr< UnitsParams > ¶ms) |
| | Constructs a Unit object.
|
| |
| auto | getCoord () const |
| | Retrieves the current coordinates of the unit.
|
| |
| auto | getID () const |
| | Retrieves the ID of the unit.
|
| |
| virtual void | updateState (const std::shared_ptr< Unit > &another)=0 |
| | Updates the state of the unit based on interaction with another unit.
|
| |
| virtual void | walk ()=0 |
| | Executes the walking behavior of the unit.
|
| |
| virtual void | die ()=0 |
| | Executes the death behavior of the unit.
|
| |
| virtual | ~Unit ()=default |
| | Virtual destructor for Unit.
|
| |
| | Unit (const Unit &other)=default |
| |
| Unit & | operator= (const Unit &other)=default |
| |
| | Unit (Unit &&other)=default |
| |
| Unit & | operator= (Unit &&other)=default |
| |
|
| void | setID (const size_t id) |
| | Sets the ID of the unit.
|
| |
| void | setCoord (const Point coord) |
| | Sets the coordinates of the unit.
|
| |
Represents a generic unit in the simulation.
◆ Unit() [1/3]
| Unit::Unit |
( |
size_t |
id, |
|
|
const std::shared_ptr< UnitsParams > & |
params |
|
) |
| |
|
explicit |
Constructs a Unit object.
- Parameters
-
| id | The unique ID of the unit. |
◆ ~Unit()
Virtual destructor for Unit.
◆ Unit() [2/3]
| Unit::Unit |
( |
const Unit & |
other | ) |
|
|
default |
◆ Unit() [3/3]
| Unit::Unit |
( |
Unit && |
other | ) |
|
|
default |
◆ die()
| virtual void Unit::die |
( |
| ) |
|
|
pure virtual |
Executes the death behavior of the unit.
Implemented in Creeper, and Steve.
◆ getCoord()
| auto Unit::getCoord |
( |
| ) |
const |
|
inline |
Retrieves the current coordinates of the unit.
- Returns
- The current coordinates.
◆ getID()
| auto Unit::getID |
( |
| ) |
const |
|
inline |
Retrieves the ID of the unit.
- Returns
- The unique ID of the unit.
◆ operator=() [1/2]
| Unit & Unit::operator= |
( |
const Unit & |
other | ) |
|
|
default |
◆ operator=() [2/2]
◆ setCoord()
| void Unit::setCoord |
( |
const Point |
coord | ) |
|
|
inlineprotected |
Sets the coordinates of the unit.
- Parameters
-
| coord | The new coordinates. |
◆ setID()
| void Unit::setID |
( |
const size_t |
id | ) |
|
|
inlineprotected |
Sets the ID of the unit.
- Parameters
-
◆ updateState()
| virtual void Unit::updateState |
( |
const std::shared_ptr< Unit > & |
another | ) |
|
|
pure virtual |
Updates the state of the unit based on interaction with another unit.
- Parameters
-
| another | Shared pointer to another unit. |
Implemented in Creeper, and Steve.
◆ walk()
| virtual void Unit::walk |
( |
| ) |
|
|
pure virtual |
Executes the walking behavior of the unit.
Implemented in Creeper, and Steve.
The documentation for this class was generated from the following files:
- model/creeper-simulation-library/units/Unit.hpp
- model/creeper-simulation-library/units/Unit.cpp