49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
#ifndef CHARACTER_MANAGER_CLASS
|
|
#define CHARACTER_MANAGER_CLASS
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
class Character;
|
|
class Physics;
|
|
class Rig;
|
|
class Animation;
|
|
|
|
class CharacterManager {
|
|
public:
|
|
CharacterManager();
|
|
~CharacterManager();
|
|
|
|
Rig* LoadRig(const std::string& name, const std::string& path);
|
|
Animation* LoadAnimation(const std::string& name, const std::string& path,
|
|
const std::string& rigName = "");
|
|
Character* CreateCharacter(const std::string& name,
|
|
const std::string& rigName = "",
|
|
const std::string& animationName = "");
|
|
|
|
Rig* GetRig(const std::string& name) const;
|
|
Animation* GetAnimation(const std::string& name) const;
|
|
Character* GetCharacter(const std::string& name) const;
|
|
|
|
void SetControlledCharacter(const std::string& name);
|
|
void PressInput(char letter);
|
|
void ReleaseInput(char letter);
|
|
void ClearInput();
|
|
|
|
void Step(float dt);
|
|
void ResolveCombat(Physics& physics);
|
|
|
|
const std::vector<Character*>& GetCharacters() const { return characterOrder; }
|
|
|
|
private:
|
|
std::unordered_map<std::string, std::unique_ptr<Rig>> rigs;
|
|
std::unordered_map<std::string, std::unique_ptr<Animation>> animations;
|
|
std::unordered_map<std::string, std::unique_ptr<Character>> characters;
|
|
std::vector<Character*> characterOrder;
|
|
Character* controlledCharacter = nullptr;
|
|
};
|
|
|
|
#endif
|