Player does not get any gadgets on spawn now.
This commit is contained in:
parent
55fbf1be20
commit
0daf1cf6d6
2 changed files with 15 additions and 11 deletions
|
@ -10,8 +10,6 @@
|
|||
#include <Thor/Vectors.hpp>
|
||||
|
||||
#include "generator/Generator.h"
|
||||
#include "sprites/items/Heal.h"
|
||||
#include "sprites/items/RingOfFire.h"
|
||||
#include "sprites/Enemy.h"
|
||||
#include "sprites/Player.h"
|
||||
#include "util/Loader.h"
|
||||
|
@ -58,8 +56,6 @@ Game::Game(tgui::Window& window) :
|
|||
void Game::initPlayer() {
|
||||
mPlayer = std::shared_ptr<Player>(new Player(mWorld, mPathfinder,
|
||||
mGenerator.getPlayerSpawn()));
|
||||
mPlayer->setLeftGadget(std::shared_ptr<Gadget>(new Heal()));
|
||||
mPlayer->setRightGadget(std::shared_ptr<Gadget>(new RingOfFire(mWorld)));
|
||||
mWorld.insertCharacter(mPlayer);
|
||||
}
|
||||
|
||||
|
|
|
@ -289,22 +289,28 @@ Character::setRightGadget(std::shared_ptr<Gadget> gadget) {
|
|||
|
||||
void
|
||||
Character::useLeftGadget() {
|
||||
if (mLeftGadget)
|
||||
mLeftGadget->use(*this);
|
||||
}
|
||||
|
||||
void
|
||||
Character::useRightGadget() {
|
||||
if (mRightGadget)
|
||||
mRightGadget->use(*this);
|
||||
}
|
||||
|
||||
std::string
|
||||
Character::getLeftGadgetName() const {
|
||||
return mLeftGadget->getName();
|
||||
return (mLeftGadget)
|
||||
? mLeftGadget->getName()
|
||||
: "";
|
||||
}
|
||||
|
||||
std::string
|
||||
Character::getRightGadgetName() const {
|
||||
return mRightGadget->getName();
|
||||
return (mRightGadget)
|
||||
? mRightGadget->getName()
|
||||
: "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,8 +337,10 @@ Character::pickUpItem() {
|
|||
}
|
||||
std::shared_ptr<Gadget> gadget = std::dynamic_pointer_cast<Gadget>(closest);
|
||||
if (gadget) {
|
||||
if (mRightGadget) {
|
||||
mWorld.insert(mRightGadget);
|
||||
mRightGadget->drop(getPosition());
|
||||
}
|
||||
mRightGadget = mLeftGadget;
|
||||
mLeftGadget = gadget;
|
||||
}
|
||||
|
|
Reference in a new issue