Creepy-simulation
 
Loading...
Searching...
No Matches
Steve.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Unit.hpp"
8class StevesParams final : public UnitsParams {
9 public:
14 enum class State : std::uint8_t { Born, Walk, Dead };
21 StevesParams(double moveRadius, const std::shared_ptr<FieldParams> &fieldParams, uint32_t unitsCount);
22};
30class Steve final : public Unit, std::enable_shared_from_this<Steve> {
31 std::shared_ptr<StevesParams> params_;
33
34 public:
40 Steve(const size_t id, const std::shared_ptr<StevesParams> &params) : Unit(id, params), params_(params) {}
45 void updateState(const std::shared_ptr<Unit> &another) override;
49 void walk() override;
53 void die() override;
58 decltype(state_) getState() { return state_; }
59};
Represents an individual Steve unit in the simulation.
Definition Steve.hpp:30
void updateState(const std::shared_ptr< Unit > &another) override
Updates the state of the Steve based on interaction with another unit.
Definition Steve.cpp:17
void walk() override
Executes the walking behavior of the Steve.
Definition Steve.cpp:5
Steve(const size_t id, const std::shared_ptr< StevesParams > &params)
Constructs a Steve object.
Definition Steve.hpp:40
void die() override
Executes the death behavior of the Steve.
Definition Steve.cpp:19
decltype(state_) getState()
Retrieves the current state of the Steve.
Definition Steve.hpp:58
Configuration parameters for Steve units in the simulation.
Definition Steve.hpp:8
State
Possible states of a Steve.
Definition Steve.hpp:14
Represents a generic unit in the simulation.
Definition Unit.hpp:63
Configuration parameters shared among multiple units.
Definition Unit.hpp:12