SpelunkyRemake / Enemy.h
Enemy.h
Raw
#pragma once
#include "Level.h"
#include "Player.h"
#include "ParticleManager.h"

class Enemy
{
public:
	enum class Direction { LEFT, RIGHT };

	Enemy(int x, int y);
	Enemy(const Point2f& pos);
	virtual ~Enemy() = 0;

	virtual void Draw() const;
	virtual void Update(float elapsedSec, const Level& level, Player* pPlayer, ParticleManager* pParticleManager) = 0;

	std::vector<Point2f> GetTopVertices() const;

	virtual void CenterInTile();

	Rectf& GetHitbox();
	int GetLives() const;

protected:
	int m_Lives;

	Texture* m_pTexture;
	Direction m_Direction;

	Rectf m_Hitbox;
	Vector2f m_HitboxMargin;
	Rectf m_SrcRect;
	Vector2f m_Velocity;
	float m_Angle;

	Rectf m_SpriteRect;

	static const float m_ClipWidth;
	static const float m_ClipHeight;

	static const Vector2f m_GravityAcceleration;

	int m_AnimFirstFrameId;
	int m_AnimLength;
	bool m_AnimLoop;
	int m_NrFramesPerSec;
	float m_AnimTime;
	int m_AnimFrame;
};