mirror of
https://github.com/Motschen/Adventura.git
synced 2025-12-17 04:05:10 +01:00
Because of a weird task requirement, folders are not allowed
Who tf came up with this limitation? Seriously...
This commit is contained in:
81
blockSettings.hpp
Normal file
81
blockSettings.hpp
Normal file
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
class BlockSettings {
|
||||
public:
|
||||
BlockSettings() {}
|
||||
bool isSolid() {
|
||||
return isSolid_;
|
||||
}
|
||||
bool hasCollision() {
|
||||
return hasCollision_;
|
||||
}
|
||||
bool hasGravity() {
|
||||
return hasGravity_;
|
||||
}
|
||||
bool isPushable() {
|
||||
return isPushable_;
|
||||
}
|
||||
bool isLethal() {
|
||||
return isLethal_;
|
||||
}
|
||||
bool isBrittle() {
|
||||
return isBrittle_;
|
||||
}
|
||||
bool isClimbableFromTop() {
|
||||
return isClimbableFromTop_;
|
||||
}
|
||||
bool isClimbableFromBottom() {
|
||||
return isClimbableFromBottom_;
|
||||
}
|
||||
|
||||
friend class BlockSettingsBuilder;
|
||||
|
||||
private:
|
||||
bool isSolid_ = true;
|
||||
bool isPushable_ = false;
|
||||
bool isClimbableFromTop_ = false;
|
||||
bool isClimbableFromBottom_ = false;
|
||||
bool isLethal_ = false;
|
||||
bool isBrittle_ = false;
|
||||
bool hasCollision_ = false;
|
||||
bool hasGravity_ = false;
|
||||
};
|
||||
class BlockSettingsBuilder {
|
||||
public:
|
||||
BlockSettingsBuilder nonSolid() {
|
||||
blockSettings.isSolid_ = false;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder pushable() {
|
||||
blockSettings.isPushable_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder collidable() {
|
||||
blockSettings.hasCollision_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder gravity() {
|
||||
blockSettings.hasGravity_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder lethal() {
|
||||
blockSettings.isLethal_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder brittle() {
|
||||
blockSettings.isBrittle_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder climbableFromTop() {
|
||||
blockSettings.isClimbableFromTop_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettingsBuilder climbableFromBottom() {
|
||||
blockSettings.isClimbableFromBottom_ = true;
|
||||
return *this;
|
||||
}
|
||||
BlockSettings build() {
|
||||
return blockSettings;
|
||||
}
|
||||
private:
|
||||
BlockSettings blockSettings = BlockSettings();
|
||||
};
|
||||
Reference in New Issue
Block a user