2021-09-13 12:47:09 +00:00
|
|
|
#pragma once
|
|
|
|
#include "Position.hpp"
|
2021-09-15 11:39:42 +00:00
|
|
|
#include <chrono>
|
2021-09-13 12:47:09 +00:00
|
|
|
|
|
|
|
namespace pacman {
|
|
|
|
|
2021-09-15 11:39:42 +00:00
|
|
|
struct GameState;
|
2021-09-13 12:47:09 +00:00
|
|
|
|
2021-09-15 11:39:42 +00:00
|
|
|
class Fruits {
|
2021-09-13 12:47:09 +00:00
|
|
|
public:
|
2021-09-15 11:39:42 +00:00
|
|
|
void update(std::chrono::milliseconds time_delta, const GameState & gameState);
|
2021-09-15 12:40:07 +00:00
|
|
|
|
2021-09-15 11:39:42 +00:00
|
|
|
GridPosition currentSprite() const;
|
|
|
|
Position position() const;
|
2021-09-15 12:40:07 +00:00
|
|
|
|
2021-09-15 11:39:42 +00:00
|
|
|
bool isVisible() const;
|
|
|
|
int value() const;
|
|
|
|
int eat();
|
2021-09-13 12:47:09 +00:00
|
|
|
|
|
|
|
private:
|
2021-09-15 11:39:42 +00:00
|
|
|
bool visible = false;
|
|
|
|
int index = 0;
|
|
|
|
std::chrono::milliseconds time_visible{ 0 };
|
2021-09-15 12:40:07 +00:00
|
|
|
|
|
|
|
void hide();
|
2021-09-13 12:47:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pacman
|