SpelunkyRemake / Item.h
Item.h
Raw
#pragma once
#include "Level.h"
#include "Texture.h"

class Item
{
public:
	enum class Type { GOLD_COIN, GOLD_3COINS, GOLD_CHUNK_BIG, GOLD_CHUNK_SMALL };

	enum class ActionState { IDLE, HELD, FALLING, THROWN };

	Item(int x, int y);
	Item(const Point2f& pos);
	Item(const Point2f& pos, float width, float height, const Rectf& srcRect, const Vector2f& hitboxMargin);
	virtual ~Item() = 0;

	virtual size_t GetTypeHash() const = 0;

	virtual void Draw() const;
	virtual void Update(float elapsedSec, const Level& level);

	virtual void CenterInTile();

	//virtual void Pickup() = 0;

	Rectf& GetHitbox();

	static Texture* m_pTextures;
	
protected:
	Rectf m_Hitbox;
	Vector2f m_HitboxMargin;
	Rectf m_SrcRect;
	Vector2f m_Velocity;
	float m_Angle;

	Rectf m_SpriteRect;
	ActionState m_ActionState;

	static const float m_ClipWidth;
	static const float m_ClipHeight;

	static const Vector2f m_GravityAcceleration;

private:
	static int m_Count;
};