igra
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
#include <game/agame/trash.hpp>
|
||||
#include <game/agame/player.hpp>
|
||||
#include <object/components/boxcollider.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Game::AGame {
|
||||
void Trash::start() {
|
||||
mZIndex = 20;
|
||||
addComponent<Object::Components::BoxCollider>();
|
||||
}
|
||||
|
||||
void Trash::update(float deltaTime) {
|
||||
(void)deltaTime;
|
||||
return;
|
||||
}
|
||||
|
||||
void Trash::onCollisionEnter(Object::Entity* other) {
|
||||
auto* player = dynamic_cast<Player*>(other);
|
||||
if (!player || !player->isShipMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameManager::setSharedData("trashActiveCount", std::max(0, GameManager::getSharedData<int>("trashActiveCount") - 1));
|
||||
GameManager::setSharedData("gameScore", GameManager::getSharedData<int>("gameScore") + 25);
|
||||
GameManager::destroyEntity(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user