2021-10-02 20:36:07 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 22.09.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SHOOTER_SHOOTER_H
|
|
|
|
#define SHOOTER_SHOOTER_H
|
|
|
|
|
2023-05-21 16:34:55 +03:00
|
|
|
#include "3dzavr/engine/Engine.h"
|
2022-07-19 12:37:37 +03:00
|
|
|
#include "player/Player.h"
|
|
|
|
#include "player/PlayerController.h"
|
|
|
|
#include "player/PlayerController.h"
|
2023-05-21 16:34:55 +03:00
|
|
|
#include "3dzavr/engine/gui/Window.h"
|
2021-10-02 20:36:07 +03:00
|
|
|
|
2022-07-19 12:35:14 +03:00
|
|
|
#include "network/ShooterClient.h"
|
|
|
|
#include "network/ShooterServer.h"
|
2021-10-02 20:36:07 +03:00
|
|
|
|
|
|
|
|
2021-10-12 20:18:56 +03:00
|
|
|
class Shooter final : public Engine {
|
2021-10-02 20:36:07 +03:00
|
|
|
private:
|
2021-11-06 22:11:06 +03:00
|
|
|
std::shared_ptr<Player> player = std::make_shared<Player>(ObjectNameTag("Player"),
|
|
|
|
ShooterConsts::CUBE_OBJ,
|
2022-07-19 12:57:09 +03:00
|
|
|
Vec3D{1.5, 1.8, 1.5});
|
2021-10-29 18:41:07 +03:00
|
|
|
std::shared_ptr<PlayerController> playerController = std::make_shared<PlayerController>(player, keyboard, mouse);
|
2021-10-02 20:36:07 +03:00
|
|
|
|
|
|
|
Window mainMenu;
|
|
|
|
|
2021-10-29 18:41:07 +03:00
|
|
|
std::shared_ptr<ShooterServer> server = std::make_shared<ShooterServer>();
|
|
|
|
std::shared_ptr<ShooterClient> client = std::make_shared<ShooterClient>(player);
|
2022-07-22 22:52:54 +03:00
|
|
|
std::shared_ptr<ChatManager> chat = std::make_shared<ChatManager>();
|
|
|
|
bool isTypingMessage = false;
|
|
|
|
string message = "";
|
2021-10-02 20:36:07 +03:00
|
|
|
|
|
|
|
bool inGame = false;
|
|
|
|
int fireTraces = 0;
|
2023-05-21 16:34:55 +03:00
|
|
|
std::string current_map = ShooterConsts::MAP_OBJ;
|
2021-10-02 20:36:07 +03:00
|
|
|
|
|
|
|
void start() override;
|
|
|
|
void update() override;
|
|
|
|
void gui() override;
|
2022-07-22 22:52:54 +03:00
|
|
|
void drawChat();
|
2021-10-02 20:36:07 +03:00
|
|
|
void play();
|
|
|
|
void drawPlayerStats();
|
2021-10-26 09:40:35 +03:00
|
|
|
void drawStatsTable();
|
2021-10-31 11:39:08 +03:00
|
|
|
|
2021-11-13 18:30:12 +03:00
|
|
|
void initNetwork();
|
2021-10-02 20:36:07 +03:00
|
|
|
|
|
|
|
void spawnPlayer(sf::Uint16 id);
|
|
|
|
void removePlayer(sf::Uint16 id);
|
2021-10-31 11:39:08 +03:00
|
|
|
void addFireTrace(const Vec3D &from, const Vec3D &to);
|
|
|
|
void removeFireTrace(const ObjectNameTag &traceName);
|
|
|
|
void addBonus(const std::string &bonusName, const Vec3D &position);
|
|
|
|
void removeBonus(const ObjectNameTag &bonusName);
|
2021-10-02 20:36:07 +03:00
|
|
|
void addWeapon(std::shared_ptr<Weapon> weapon);
|
|
|
|
void removeWeapon(std::shared_ptr<Weapon> weapon);
|
2021-10-31 11:39:08 +03:00
|
|
|
void changeEnemyWeapon(const std::string &weaponName, sf::Uint16 enemyId);
|
|
|
|
|
2021-10-02 20:36:07 +03:00
|
|
|
public:
|
|
|
|
Shooter() : mainMenu(screen, mouse) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //SHOOTER_SHOOTER_H
|