Portal.cpp 560 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "Portal.h"
  2. #include "Model.h"
  3. #include <iostream>
  4. #include "Player.h"
  5. #include "WorldHandler.h"
  6. Portal::Portal(const std::string &fileName,
  7. const Vec3f &position,
  8. Vec3f &rotation,
  9. const float &scale)
  10. {
  11. model = Model::load(fileName);
  12. this->position = position;
  13. this->rotation = rotation;
  14. this->scale = scale;
  15. this->canCollide = true;
  16. mayEnter = false;
  17. maxCrystals = 0;
  18. }
  19. Portal::~Portal()
  20. {
  21. }
  22. void Portal::collide()
  23. {
  24. if (maxCrystals == (Player::getInstance()->crystals) && !mayEnter)
  25. {
  26. canCollide = false;
  27. mayEnter = true;
  28. }
  29. }