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);
|
|
|
|
GridPosition currentSprite() const;
|
|
|
|
Position position() const;
|
|
|
|
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
|
|
|
void hide();
|
|
|
|
bool visible = false;
|
|
|
|
int index = 0;
|
|
|
|
std::chrono::milliseconds time_visible{ 0 };
|
2021-09-13 12:47:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pacman
|