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

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

    ERR_FAIL_COND_V(!tile_map.has(id),false);

    String what = n.substr(slash+1,n.length());

    if (what=="name")
        r_ret=tile_get_name(id);
    else if (what=="texture")
        r_ret=tile_get_texture(id);
    else if (what=="tex_offset")
        r_ret=tile_get_texture_offset(id);
    else if (what=="shape_offset")
        r_ret=tile_get_shape_offset(id);
    else if (what=="region")
        r_ret=tile_get_region(id);
    else if (what=="shape")
        r_ret=tile_get_shape(id);
    else if (what=="shapes")
        r_ret=_tile_get_shapes(id);
    else
        return false;

    return true;

}
Beispiel #2
0
bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {

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

	ERR_FAIL_COND_V(!tile_map.has(id), false);

	String what = n.substr(slash + 1, n.length());

	if (what == "name")
		r_ret = tile_get_name(id);
	else if (what == "texture")
		r_ret = tile_get_texture(id);
	else if (what == "normal_map")
		r_ret = tile_get_normal_map(id);
	else if (what == "tex_offset")
		r_ret = tile_get_texture_offset(id);
	else if (what == "material")
		r_ret = tile_get_material(id);
	else if (what == "modulate")
		r_ret = tile_get_modulate(id);
	else if (what == "region")
		r_ret = tile_get_region(id);
	else if (what == "shape")
		r_ret = tile_get_shape(id, 0);
	else if (what == "shape_offset")
		r_ret = tile_get_shape_transform(id, 0).get_origin();
	else if (what == "shape_transform")
		r_ret = tile_get_shape_transform(id, 0);
	else if (what == "shape_one_way")
		r_ret = tile_get_shape_one_way(id, 0);
	else if (what == "shapes")
		r_ret = _tile_get_shapes(id);
	else if (what == "occluder")
		r_ret = tile_get_light_occluder(id);
	else if (what == "occluder_offset")
		r_ret = tile_get_occluder_offset(id);
	else if (what == "navigation")
		r_ret = tile_get_navigation_polygon(id);
	else if (what == "navigation_offset")
		r_ret = tile_get_navigation_polygon_offset(id);
	else
		return false;

	return true;
}