R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Player.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** RTYPE
4** File description:
5** Player
6*/
7
8#pragma once
9
10#include "IComponent.hpp"
11
12namespace ecs {
20 class Player : public IComponent {
21 public:
28 Player(int score, int lives, uint32_t playerId) : _score(score), _lives(lives), _playerId(playerId) {}
29 ~Player() override = default;
30
35 int getScore() const { return _score; }
36
41 int getLives() const { return _lives; }
42
47 int getPlayerId() const { return _playerId; }
48
53 void setScore(int score) { _score = score; }
54
59 void setLives(int lives) { _lives = lives; }
60
65 void setPlayerId(int playerId) { _playerId = playerId; }
66
71 ComponentType getType() const override { return getComponentType<Player>(); }
72
73 private:
74 int _score;
75 int _lives;
77 };
78} // namespace ecs
Base interface for all ECS components.
Component identifying an entity as a player with game statistics.
Definition Player.hpp:20
ComponentType getType() const override
Get the component type ID.
Definition Player.hpp:71
int getLives() const
Get remaining lives.
Definition Player.hpp:41
void setLives(int lives)
Set remaining lives.
Definition Player.hpp:59
int _score
Player's current score.
Definition Player.hpp:74
int _lives
Remaining lives.
Definition Player.hpp:75
void setScore(int score)
Set player's score.
Definition Player.hpp:53
void setPlayerId(int playerId)
Set player ID.
Definition Player.hpp:65
int getScore() const
Get player's score.
Definition Player.hpp:35
int _playerId
Unique player identifier.
Definition Player.hpp:76
Player(int score, int lives, uint32_t playerId)
Constructor with all player data.
Definition Player.hpp:28
~Player() override=default
int getPlayerId() const
Get player ID.
Definition Player.hpp:47
Maximum number of distinct component types supported by the Registry.
Definition GameLogic.hpp:26
std::size_t ComponentType
Type alias for component identification.