Creepy-simulation
 
Loading...
Searching...
No Matches
Creeper Class Referencefinal

Represents an individual creeper in the simulation. More...

#include <Creeper.hpp>

Inheritance diagram for Creeper:
Unit

Public Member Functions

 Creeper (size_t id, const std::shared_ptr< CreepersParams > &params)
 Constructs a Creeper object.
 
void begin ()
 Initializes the creeper's behavior.
 
void steveSearch (const std::shared_ptr< Steve > &steve)
 Searches for a Steve target.
 
void walk () override
 Executes the walking behavior of the creeper.
 
void updateState (const std::shared_ptr< Unit > &another) override
 Updates the state of the unit based on interaction with another unit.
 
void die () override
 Executes the death behavior of the unit.
 
decltype(state_) getState () const
 
- Public Member Functions inherited from Unit
 Unit (size_t id, const std::shared_ptr< UnitsParams > &params)
 Constructs a Unit object.
 
auto getCoord () const
 Retrieves the current coordinates of the unit.
 
auto getID () const
 Retrieves the ID of the unit.
 
virtual ~Unit ()=default
 Virtual destructor for Unit.
 
 Unit (const Unit &other)=default
 
Unitoperator= (const Unit &other)=default
 
 Unit (Unit &&other)=default
 
Unitoperator= (Unit &&other)=default
 

Additional Inherited Members

- Protected Member Functions inherited from Unit
void setID (const size_t id)
 Sets the ID of the unit.
 
void setCoord (const Point coord)
 Sets the coordinates of the unit.
 

Detailed Description

Represents an individual creeper in the simulation.

The Creeper class manages the behavior, state, and interactions of a single creeper within the simulation.

Constructor & Destructor Documentation

◆ Creeper()

Creeper::Creeper ( size_t  id,
const std::shared_ptr< CreepersParams > &  params 
)

Constructs a Creeper object.

Parameters
idUnique ID of the creeper.
paramsShared pointer to creeper parameters.

Member Function Documentation

◆ begin()

void Creeper::begin ( )

Initializes the creeper's behavior.

◆ die()

void Creeper::die ( )
overridevirtual

Executes the death behavior of the unit.

Implements Unit.

◆ getState()

decltype(state_) Creeper::getState ( ) const
inline

◆ steveSearch()

void Creeper::steveSearch ( const std::shared_ptr< Steve > &  steve)

Searches for a Steve target.

Parameters
steveShared pointer to a Steve object.

◆ updateState()

void Creeper::updateState ( const std::shared_ptr< Unit > &  another)
overridevirtual

Updates the state of the unit based on interaction with another unit.

Parameters
anotherShared pointer to another unit.

Implements Unit.

◆ walk()

void Creeper::walk ( )
overridevirtual

Executes the walking behavior of the creeper.

Implements Unit.


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