ICT290 / src / scene / theArchanist / theArchanist.h
theArchanist.h
Raw
#pragma once

#include <glm/glm.hpp>
#include <memory>
#include <random>
#include <vector>
#include "../../engine/light.h"
#include "../../engine/resources.h"
#include "../../engine/stateManager.h"
#include "../AIController/AITest.h"
#include "../entities/player.h"
#include "map/gameMap.h"
#include "map/gameRoom.h"

struct theArchanistSounds {
    Sound explosion{"explosion.ogg", false, 50, true, glm::vec3{0, 0, 0}, 3.5f};
    Sound music{"combat.ogg", true, 10};
    Sound click{"buttonClick.ogg", false, 60};
    Sound batDeath{"batDeath.ogg", false, 70, true, glm::vec3{0, 0, 0}, 3.5f};
    Sound magicShot{"magicShot.ogg", false, 30, true, glm::vec3{0, 0, 0}, 3.5f};
};

struct theArchanistLights {
    std::size_t L1{0};
    std::size_t L2{1};
};

enum Difficulty { easy = 0, normal, hard };

struct GameInfo {
    int seed{0};
    int currentLevel{0};
    int lastLevel{3};
    Difficulty difficulty{normal};
    bool paused{false};
    float time{0};
    bool allEnemiesDead{false};
    float spawnRate{0};
    int playerHealth{1000};
    bool victory{false};
    int enemiesKilled{0};
};

class theArchanist {
   public:
    static std::shared_ptr<State> init(Resources& engineResources,
                                       int seed,
                                       int levels,
                                       int difficulty);

    static void destroy();

    static void pause(bool option);

    static void handleEvents(SDL_Event& event);

    static void update(float deltaTime);

    static void draw();

   private:
    static std::shared_ptr<State> m_thisState;
    static theArchanistSounds m_sounds;
    static theArchanistLights m_light;
    static gameMap m_map;
    static GameWorld m_WorldController;
    static glm::vec3 clickWorldCoordinates();
    static GameInfo m_gameInfo;
    static Player m_player;
    static std::list<std::pair<Object, glm::vec3>> m_collisionObjects;

    static void drawTrapDoor();

    static void loadTrapDoorObj();

    static bool isTrapDoor(const std::string& name);

    static void trapDoorUpdate();

    static void setCamera();

    static void updatePlayerObject(float deltaTime);

    static void createPlayerObject();

    static std::shared_ptr<Model> getRandomEnemyModel();

    static void createEnemyObject(int id,
                                  const glm::vec3& location,
                                  const glm::vec3& rotation,
                                  const glm::vec3& scale);

    static void updateEnemyObjects(float deltaTime);

    static void updateDeadEnemyObjects();

    static float getHeadingAngle(const glm::vec2& heading);

    static void createProjectileObj(int id,
                                    const glm::vec3& location,
                                    const glm::vec3& rotation,
                                    const glm::vec3& scale);

    static void destroyProjectileObjs();

    static void updateProjectileObjects();

    static void createShadow(int id, float scale);

    static void updateShadow(int id, const glm::vec3& location);

    static void newLevel(int rooms);

    static void setDifficultySettings();

    static bool isGameOver();

    static void createCollisionParticles(int id,
                                         const glm::vec3& location,
                                         const glm::vec3& scale,
                                         const glm::vec2& heading,
                                         std::shared_ptr<Model>& model,
                                         int amount,
                                         float speed);

    static void updateCollisionParticles(float deltaTime);
};