| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #include "Crystal.h"
- #include "Model.h"
- #include "Player.h"
- Crystal::Crystal(const std::string & filled, const std::string & empty, const Vec3f & position, Vec3f & rotation, const float & scale)
- {
- this->filled = filled;
- this->empty = empty;
- model = Model::load(this->filled);
- this->position = position;
- this->rotation = rotation;
- this->scale = scale;
- this->canCollide = true;
- isFilled = true;
- }
- Crystal::~Crystal()
- {
- if (model)
- Model::unload(model);
- }
- void Crystal::draw()
- {
- Entity::draw();
- }
- void Crystal::collide()
- {
- if (isFilled)
- {
- Player::getInstance()->crystals++;
- isFilled = false;
- model = Model::load(empty);
- }
- }
|