Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <string>
- using namespace std;
- //BLOCK
- class Block
- {
- public:
- virtual string GetBlockName() = 0;
- virtual double GetHardness() = 0;
- virtual string GetItemFromBlock() = 0;
- private:
- };
- //LIGHT EMITTING
- class LightEmittingBlock : public Block
- {
- public:
- virtual double GetLightLevel() = 0;
- virtual bool IsBlockEmittingLight() = 0;
- virtual void OnPlayerClick() = 0;
- double lightLevel;
- bool isLit;
- private:
- };
- class Lamp : public LightEmittingBlock
- {
- public:
- string GetBlockName();
- double GetHardness();
- string GetItemFromBlock();
- double GetLightLevel();
- bool IsBlockEmittingLight();
- void OnPlayerClick();
- double lightLevel = 1;
- bool isLit = false;
- private:
- };
- double Lamp::GetHardness()
- {
- double hardness = 0.5;
- return hardness;
- }
- string GetBlockName()
- {
- string name = "Lamp";
- return name;
- }
- string GetItemFromBlock()
- {
- string item = "glowstone";
- return item;
- }
- double GetLightLevel(Lamp x)
- {
- double level = x.lightLevel;
- return level;
- }
- void OnPlayerClick(Lamp x)
- {
- if (x.isLit == false)
- {
- x.isLit = true;
- }
- if (x.isLit == true)
- {
- x.isLit = false;
- }
- }
- //STONE
- class Stone : public Block
- {
- public:
- string GetBlockName();
- double GetHardness();
- string GetItemFromBlock();
- private:
- };
- string Stone::GetBlockName()
- {
- string name = "Stone";
- return name;
- }
- double Stone::GetHardness()
- {
- double hardness = 1.5;
- return hardness;
- }
- string Stone::GetItemFromBlock()
- {
- string item = "Cobblestone";
- return item;
- }
- //BURNABLES
- class BurnableBlock : public Block
- {
- public:
- virtual double GetBurnDuration();
- virtual void Burn();
- double burnDuration;
- private:
- };
- class WoodPlanks : public BurnableBlock
- {
- public:
- string GetBlockName();
- double GetHardness();
- string GetItemFromBlock();
- double GetBurnDuration();
- void Burn();
- private:
- };
- double WoodPlanks::GetHardness()
- {
- double hardness = 1.5;
- return hardness;
- }
- string WoodPlanks::GetBlockName()
- {
- string name = "Wood Planks";
- return name;
- }
- string GetItemFromBlock()
- {
- string item = "Wood Planks";
- return item;
- }
- double GetBurnDuration()
- {
- double burn = 32.5;
- return burn;
- }
- void Burn()
- {
- cout << "It's burning!" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement