52 lines
No EOL
1.3 KiB
C++
52 lines
No EOL
1.3 KiB
C++
#ifndef _H_GAMEACTOR_H
|
|
#define _H_GAMEACTOR_H
|
|
|
|
#include <unordered_map>
|
|
#include <SDL_timer.h>
|
|
|
|
#include "entity.h"
|
|
#include "mousestate.h"
|
|
|
|
class Component;
|
|
class AI;
|
|
class Weapon;
|
|
class EventManager;
|
|
|
|
class GameActor : public Entity
|
|
{
|
|
public:
|
|
GameActor(const std::shared_ptr<Shader>& shader) : Entity(shader) { actorid = SDL_GetTicks(); }
|
|
~GameActor();
|
|
|
|
void addComponent(std::shared_ptr<Component> component);
|
|
void equipWeapon(std::shared_ptr<Weapon> weapon);
|
|
void attachEventManager(std::shared_ptr<EventManager> eventManager);
|
|
void update(float deltaTime) override;
|
|
void render(const std::shared_ptr<Camera>& camera) override;
|
|
|
|
const std::shared_ptr<Weapon>& getHeldWeapon() const;
|
|
const int getActorID() const { return actorid; }
|
|
|
|
void setRotation(const float& rotation) override;
|
|
|
|
void moveUp();
|
|
void moveDown();
|
|
void moveLeft();
|
|
void moveRight();
|
|
|
|
// Top down shooter controls, mostly for the player to use in top down shooting sections
|
|
void moveForward();
|
|
void moveBackward();
|
|
void strafeLeft();
|
|
void strafeRight();
|
|
void fireWeapon();
|
|
void followMouse(const MouseState&);
|
|
private:
|
|
int actorid;
|
|
std::vector<std::shared_ptr<Component>> components;
|
|
std::shared_ptr<AI> ai;
|
|
std::shared_ptr<Weapon> currentWeapon = nullptr;
|
|
std::shared_ptr<EventManager> eventManager;
|
|
};
|
|
|
|
#endif //_H_GAMEACTOR_H
|