-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_tiled_node_mesh_origin.gd
More file actions
29 lines (25 loc) · 1.12 KB
/
test_tiled_node_mesh_origin.gd
File metadata and controls
29 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
extends HexMapTest
var cell_origin_params = ParameterFactory.named_parameters(
["radius", "height", "cell"], [
[1, 1, HexMapCellId.at(0, 0, 0)],
[1, 10, HexMapCellId.at(0, 0, 0)],
[1, 10, HexMapCellId.at(1, 1, 1)],
[12, 3, HexMapCellId.at(1, 1, -10)],
]
)
func test_get_cell_origin(params=use_parameters(cell_origin_params)):
var node := HexMapTiled.new()
node.cell_height = params.height
node.cell_radius = params.radius
var center := node.get_cell_center(params.cell)
# this is an awful workaround because I keep getting GDScrip errors about
# Value of type "HexMapTiled.MeshOrigin" cannot be assigned to a variable
# of type "MeshOrigin"
node.mesh_origin = int(HexMapTiled.MESH_ORIGIN_TOP)
assert_eq(node.get_cell_origin(params.cell),
center + Vector3(0, params.height * 0.5, 0))
node.mesh_origin = int(HexMapTiled.MESH_ORIGIN_BOTTOM)
assert_eq(node.get_cell_origin(params.cell),
center + Vector3(0, params.height * -0.5, 0))
node.mesh_origin = int(HexMapTiled.MESH_ORIGIN_CENTER)
assert_eq(node.get_cell_origin(params.cell), center)