-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.h
57 lines (49 loc) · 1.32 KB
/
Item.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include "Block.h";
#include "Entity.h"
#include <iostream>
using namespace sf;
using namespace std;
enum item_type {
block,
tool,
material
};
class Item : public Sprite
{
private:
sf::FloatRect nextPosition;
sf::Vector2f velocity;
protected:
IDs ID;
Vector2f origin;
int stackingQuantity;
bool isUsing = false;
bool isCraftingTableRequired;
bool isFurnaceRequired;
item_type type;
vector<pair<IDs, int>> itmsRequiredToCraft;
int craftedQuantity;
int blockDamage = 0;
public:
Item();
virtual void nothing() = 0;
void GravityUpdate(float elapsed, float gravity);
void CheckCollisions(const sf::FloatRect* arg);
void goToPlayer(Vector2f playerPosition);
int getStackingQuantity();
Vector2f getSpecialOrigin() { return origin; };
IDs getID() { return ID; };
item_type getItemType() { return type; };
virtual void Update(float elapsed, Entity& entity, vector<Entity*>& entities) = 0;
virtual void Use() = 0;
virtual unique_ptr<Item> clone() const = 0;
vector<pair<IDs, int>> getItemsRequiredToCraft();
int getCraftedQuantity();
bool getIsCraftingTableRequired();
bool getIsFurnaceRequired();
int getBlockDamage();
};