18 namespace attributes {
22 const char*
const NAME =
"Name";
23 const char*
const GROUP =
"Group";
24 const char*
const ID =
"Id";
25 const char*
const POSITION =
"Position";
26 const char*
const SPEED =
"Speed";
27 const char*
const ORIENTATION =
"Orientation";
47 const CharacterId _id;
49 std::atomic<float> _orientation;
51 std::atomic<float> _speed;
52 CharacterAttributes _attributes;
56 _id(
id), _orientation(0.0f), _speed(0.0f) {
62 bool operator ==(
const ICharacter& character)
const;
63 bool operator !=(
const ICharacter& character)
const;
65 CharacterId getId()
const;
70 virtual void setPosition(
const glm::vec3& position);
72 const glm::vec3& getPosition()
const;
102 virtual void setAttribute(
const std::string& key,
const std::string& value);
115 virtual void update(int64_t dt,
bool debuggingActive) {
117 (void)debuggingActive;
124 inline std::shared_ptr<ICharacter>
ptr() {
125 return shared_from_this();
130 ai_assert(!isInfinite(position),
"invalid position");
131 _position = position;
135 _orientation = orientation;
143 _attributes[key] = value;
150 inline bool ICharacter::operator ==(
const ICharacter& character)
const {
151 return character._id == _id;
154 inline bool ICharacter::operator !=(
const ICharacter& character)
const {
155 return character._id != _id;
158 inline CharacterId ICharacter::getId()
const {
162 inline const glm::vec3& ICharacter::getPosition()
const {
174 typedef std::shared_ptr<ICharacter> ICharacterPtr;
176 template <
typename CharacterType>
177 inline const CharacterType& character_cast(
const ICharacter& character) {
181 template <
typename CharacterType>
182 inline CharacterType& character_cast(ICharacter& character) {
186 template <
typename CharacterType>
187 inline CharacterType& character_cast(
const ICharacterPtr& character) {
virtual void update(int64_t dt, bool debuggingActive)
override this method to let your own ICharacter implementation tick with the Zone::update ...
Definition: ICharacter.h:115
#define ai_assert(condition,...)
Provide your own assert - this is only executed in DEBUG mode.
Definition: Types.h:75
const CharacterAttributes & getAttributes() const
Get the debugger attributes.
Definition: ICharacter.h:146
const char *const NAME
Attribute for the name of an entity.
Definition: ICharacter.h:22
virtual void setOrientation(float orientation)
Definition: ICharacter.h:134
virtual void setPosition(const glm::vec3 &position)
Definition: ICharacter.h:129
std::shared_ptr< ICharacter > ptr()
Definition: ICharacter.h:124
float getOrientation() const
Definition: ICharacter.h:138
float getSpeed() const
Definition: ICharacter.h:170
Class that should be extended by the AI controlled entity class.
Definition: ICharacter.h:45
virtual void setAttribute(const std::string &key, const std::string &value)
Set an attribute that can be used for debugging.
Definition: ICharacter.h:142
Definition: NonCopyable.h:8
T ai_assert_cast(const S object)
If you compile with RTTI activated, you get additional sanity checks when using this macro to perform...
Definition: Types.h:84
virtual void setSpeed(float speed)
Sets the speed for the character in m/s.
Definition: ICharacter.h:166