Player.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "Player.h"
  2. #include "Game.h"
  3. Player::Player( Framework::Vec3<float> location, int dimensionId, int entityId )
  4. : Entity( PlayerEntityType::INSTANCE, location, dimensionId, entityId )
  5. {
  6. maxHP = 10;
  7. currentHP = 10;
  8. stamina = 10;
  9. maxStamina = 10;
  10. hunger = 10;
  11. maxHunger = 10;
  12. thirst = 10;
  13. maxThirst = 10;
  14. }
  15. void Player::setName( Framework::Text name )
  16. {
  17. this->name = name;
  18. }
  19. const char *Player::getName() const
  20. {
  21. return name;
  22. }
  23. void Player::api( Framework::StreamReader *zRequest, NetworkResponse *zResponse )
  24. {
  25. // TODO: answer API calls
  26. }
  27. PlayerEntityType::PlayerEntityType()
  28. : EntityType( ID )
  29. {}
  30. void PlayerEntityType::loadSuperEntity( Entity *zEntity, Framework::StreamReader *zReader ) const
  31. {}
  32. void PlayerEntityType::saveSuperEntity( Entity *zEntity, Framework::StreamWriter *zWriter ) const
  33. {}
  34. Entity *PlayerEntityType::createEntity( Framework::Vec3<float> position, int dimensionId, Game *zTarget, int entityId ) const
  35. {
  36. return new Player( position, dimensionId, entityId );
  37. }