mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Also added a collider type enum for TiledWallData. Not used yet.
This commit is contained in:
parent
09a4afc907
commit
c7e1f40435
@ -41,6 +41,7 @@ SOFTWARE.
|
|||||||
#include "../material_cache/prop_material_cache.h"
|
#include "../material_cache/prop_material_cache.h"
|
||||||
|
|
||||||
const String TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE = "None,Horizontal,Vertical,Both";
|
const String TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE = "None,Horizontal,Vertical,Both";
|
||||||
|
const String TiledWallData::BINDING_STRING_TILED_WALL_COLLIDER_TYPE = "None,Plane,Box,Convex Mesh,Concave Mesh";
|
||||||
|
|
||||||
TiledWallData::TiledWallTilingType TiledWallData::get_tiling_type() const {
|
TiledWallData::TiledWallTilingType TiledWallData::get_tiling_type() const {
|
||||||
return _tiling_type;
|
return _tiling_type;
|
||||||
@ -51,6 +52,15 @@ void TiledWallData::set_tiling_type(const TiledWallData::TiledWallTilingType val
|
|||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TiledWallData::TiledWallColliderType TiledWallData::get_collider_type() const {
|
||||||
|
return _collider_type;
|
||||||
|
}
|
||||||
|
void TiledWallData::set_collider_type(const TiledWallData::TiledWallColliderType value) {
|
||||||
|
_collider_type = value;
|
||||||
|
|
||||||
|
emit_changed();
|
||||||
|
}
|
||||||
|
|
||||||
void TiledWallData::add_tile(const Ref<Texture> &texture, const Vector2 &val, const float z_offset) {
|
void TiledWallData::add_tile(const Ref<Texture> &texture, const Vector2 &val, const float z_offset) {
|
||||||
_textures.push_back(texture);
|
_textures.push_back(texture);
|
||||||
}
|
}
|
||||||
@ -299,6 +309,7 @@ void TiledWallData::copy_from(const Ref<TiledWallData> &tiled_wall_data) {
|
|||||||
|
|
||||||
TiledWallData::TiledWallData() {
|
TiledWallData::TiledWallData() {
|
||||||
_tiling_type = TILED_WALL_TILING_TYPE_NONE;
|
_tiling_type = TILED_WALL_TILING_TYPE_NONE;
|
||||||
|
_collider_type = TILED_WALL_COLLIDER_TYPE_PLANE;
|
||||||
_flavour_chance = 0.15;
|
_flavour_chance = 0.15;
|
||||||
}
|
}
|
||||||
TiledWallData::~TiledWallData() {
|
TiledWallData::~TiledWallData() {
|
||||||
@ -430,6 +441,10 @@ void TiledWallData::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_tiling_type", "texture"), &TiledWallData::set_tiling_type);
|
ClassDB::bind_method(D_METHOD("set_tiling_type", "texture"), &TiledWallData::set_tiling_type);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "tiling_type", PROPERTY_HINT_ENUM, TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE), "set_tiling_type", "get_tiling_type");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "tiling_type", PROPERTY_HINT_ENUM, TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE), "set_tiling_type", "get_tiling_type");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_collider_type"), &TiledWallData::get_collider_type);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_collider_type", "texture"), &TiledWallData::set_collider_type);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_type", PROPERTY_HINT_ENUM, TiledWallData::BINDING_STRING_TILED_WALL_COLLIDER_TYPE), "set_collider_type", "get_collider_type");
|
||||||
|
|
||||||
//textures
|
//textures
|
||||||
ClassDB::bind_method(D_METHOD("add_tile", "texture", "size", "z_offset"), &TiledWallData::add_tile, Vector2(1, 1), 0);
|
ClassDB::bind_method(D_METHOD("add_tile", "texture", "size", "z_offset"), &TiledWallData::add_tile, Vector2(1, 1), 0);
|
||||||
ClassDB::bind_method(D_METHOD("remove_tile", "index"), &TiledWallData::remove_tile);
|
ClassDB::bind_method(D_METHOD("remove_tile", "index"), &TiledWallData::remove_tile);
|
||||||
|
@ -51,12 +51,24 @@ public:
|
|||||||
TILED_WALL_TILING_TYPE_BOTH
|
TILED_WALL_TILING_TYPE_BOTH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TiledWallColliderType {
|
||||||
|
TILED_WALL_COLLIDER_TYPE_NONE = 0,
|
||||||
|
TILED_WALL_COLLIDER_TYPE_PLANE,
|
||||||
|
TILED_WALL_COLLIDER_TYPE_BOX,
|
||||||
|
TILED_WALL_COLLIDER_TYPE_CONVEX_MESH,
|
||||||
|
TILED_WALL_COLLIDER_TYPE_CONCAVE_MESH
|
||||||
|
};
|
||||||
|
|
||||||
static const String BINDING_STRING_TILED_WALL_TILING_TYPE;
|
static const String BINDING_STRING_TILED_WALL_TILING_TYPE;
|
||||||
|
static const String BINDING_STRING_TILED_WALL_COLLIDER_TYPE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TiledWallTilingType get_tiling_type() const;
|
TiledWallTilingType get_tiling_type() const;
|
||||||
void set_tiling_type(const TiledWallTilingType value);
|
void set_tiling_type(const TiledWallTilingType value);
|
||||||
|
|
||||||
|
TiledWallColliderType get_collider_type() const;
|
||||||
|
void set_collider_type(const TiledWallColliderType value);
|
||||||
|
|
||||||
//textures
|
//textures
|
||||||
void add_tile(const Ref<Texture> &texture, const Vector2 &val = Vector2(1, 1), const float z_offset = 0);
|
void add_tile(const Ref<Texture> &texture, const Vector2 &val = Vector2(1, 1), const float z_offset = 0);
|
||||||
void remove_tile(const int index);
|
void remove_tile(const int index);
|
||||||
@ -124,8 +136,6 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TiledWallTilingType _tiling_type;
|
|
||||||
|
|
||||||
struct TextureEntry {
|
struct TextureEntry {
|
||||||
Ref<Texture> texture;
|
Ref<Texture> texture;
|
||||||
Vector2 size;
|
Vector2 size;
|
||||||
@ -143,6 +153,9 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TiledWallTilingType _tiling_type;
|
||||||
|
TiledWallColliderType _collider_type;
|
||||||
|
|
||||||
Vector<TextureEntry> _textures;
|
Vector<TextureEntry> _textures;
|
||||||
Vector<TextureEntry> _flavour_textures;
|
Vector<TextureEntry> _flavour_textures;
|
||||||
float _flavour_chance;
|
float _flavour_chance;
|
||||||
@ -151,5 +164,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(TiledWallData::TiledWallTilingType);
|
VARIANT_ENUM_CAST(TiledWallData::TiledWallTilingType);
|
||||||
|
VARIANT_ENUM_CAST(TiledWallData::TiledWallColliderType);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user