#ifndef LOTOSTATEK_PLAYER_H #define LOTOSTATEK_PLAYER_H #include #include #include "Actor.h" #include "Rocket.h" class Player : public Actor { // Zgodnie z refactoring.guru singleton pattern // https://refactoring.guru/design-patterns/singleton/cpp/example protected: Player(int x, int y, const sf::Texture &texture); static Player* player_; public: Player(Player &other) = delete; void operator=(const Player &) = delete; static Player* getInstance(int x, int y, const sf::Texture &texture); // Tu się kończy definicja singletona void shoot() override; void alternate_shoot(); void ultimate_shoot(); void setFirerate(unsigned int firerate); void move(float deltaX, float deltaY) override; void moveLeft() override; void moveRight() override; void moveUp() override; void moveDown() override; void takeDamage(); void setTripleShot(bool toogle); void setBulletSpeed(float speed); bool getUltimateStatus(); void update(); std::vector& getRockets(); void loadTexture(); void setUltimateStatus(bool status); private: std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now(); std::vector rockets; sf::Texture rocketTexture; sf::Texture bulletTexture; sf::Color originalColor; sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec float bulletSpeed = 10.0f; // prędkość pocisku bool isImmortal = false; // flaga na immortal bool tripleShot = false; // flaga na potrójny strzał bool ultimateShootActive = false; }; #endif //LOTOSTATEK_PLAYER_H