optimiasted crystal, entity now has a collide methode, which will be called when an entity collison has with the player.
This commit is contained in:
+8
-3
@@ -1,5 +1,6 @@
|
||||
#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)
|
||||
@@ -26,8 +27,12 @@ void Crystal::draw()
|
||||
Entity::draw();
|
||||
}
|
||||
|
||||
void Crystal::pickUp()
|
||||
void Crystal::collide()
|
||||
{
|
||||
isFilled = false;
|
||||
model = Model::load(empty);
|
||||
if (isFilled)
|
||||
{
|
||||
Player::getInstance()->crystals++;
|
||||
isFilled = false;
|
||||
model = Model::load(empty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user