Beispiel #1
0
bool TileSet::_set(const StringName &p_name, const Variant &p_value) {

	String n = p_name;
	int slash = n.find("/");
	if (slash == -1)
		return false;
	int id = String::to_int(n.c_str(), slash);

	if (!tile_map.has(id))
		create_tile(id);
	String what = n.substr(slash + 1, n.length());

	if (what == "name")
		tile_set_name(id, p_value);
	else if (what == "texture")
		tile_set_texture(id, p_value);
	else if (what == "normal_map")
		tile_set_normal_map(id, p_value);
	else if (what == "tex_offset")
		tile_set_texture_offset(id, p_value);
	else if (what == "material")
		tile_set_material(id, p_value);
	else if (what == "modulate")
		tile_set_modulate(id, p_value);
	else if (what == "region")
		tile_set_region(id, p_value);
	else if (what == "shape")
		tile_set_shape(id, 0, p_value);
	else if (what == "shape_offset") {
		Transform2D xform = tile_get_shape_transform(id, 0);
		xform.set_origin(p_value);
		tile_set_shape_transform(id, 0, xform);
	} else if (what == "shape_transform")
		tile_set_shape_transform(id, 0, p_value);
	else if (what == "shape_one_way")
		tile_set_shape_one_way(id, 0, p_value);
	else if (what == "shapes")
		_tile_set_shapes(id, p_value);
	else if (what == "occluder")
		tile_set_light_occluder(id, p_value);
	else if (what == "occluder_offset")
		tile_set_occluder_offset(id, p_value);
	else if (what == "navigation")
		tile_set_navigation_polygon(id, p_value);
	else if (what == "navigation_offset")
		tile_set_navigation_polygon_offset(id, p_value);
	else
		return false;

	return true;
}
Beispiel #2
0
bool TileSet::_set(const StringName& p_name, const Variant& p_value) {

	String n = p_name;
	int slash = n.find("/");
	if (slash==-1)
		return false;
	int id = String::to_int(n.c_str(),slash);

	if (!tile_map.has(id))
		create_tile(id);
	String what = n.substr(slash+1,n.length());

	if (what=="name")
		tile_set_name(id,p_value);
	else if (what=="texture")
		tile_set_texture(id,p_value);
	else if (what=="tex_offset")
		tile_set_texture_offset(id,p_value);
	else if (what=="material")
		tile_set_material(id,p_value);
	else if (what=="shape_offset")
		tile_set_shape_offset(id,p_value);
	else if (what=="region")
		tile_set_region(id,p_value);
	else if (what=="shape")
		tile_set_shape(id,p_value);
	else if (what=="shapes")
		_tile_set_shapes(id,p_value);
	else if (what=="occluder")
		tile_set_light_occluder(id,p_value);
	else if (what=="occluder_offset")
		tile_set_occluder_offset(id,p_value);
	else if (what=="navigation")
		tile_set_navigation_polygon(id,p_value);
	else if (what=="navigation_offset")
		tile_set_navigation_polygon_offset(id,p_value);
	else
		return false;

	return true;

}