private void createCube(int x, int y, int z) { var json = new NodeJson(NodeDataManager.NextName(NodeType.CUBE), new Vector3(x, y, z), Vector3.one * 5, "", NodeType.CUBE); NodeDataManager.AddNode(json); NodeFactory.CreateNode(json); }
public void Cuts2HoleInNonUniformRoom() { Init(); var cube1 = new NodeJson(NodeDataManager.NextName(NodeType.CUBE), new Vector3(0, 0, 0), new Vector3(4, 3, 5), "", NodeType.CUBE); NodeDataManager.AddNode(cube1); NodeFactory.CreateNode(cube1); var cube2 = new NodeJson(NodeDataManager.NextName(NodeType.CUBE), new Vector3(6, 0, 0), new Vector3(6, 5, 4), "", NodeType.CUBE); NodeDataManager.AddNode(cube2); NodeFactory.CreateNode(cube2); runCutHoleTest( new Vector3(2.5f, -0.5f, 1f), new Vector3(2, 0.5f, 0.8f), (hole) => { if (hole.behaviour.name.Contains("right")) { Assert.AreApproximatelyEqual(-1f, hole.position.x, "hole has wrong X pos"); Assert.AreApproximatelyEqual(-0.5f, hole.position.y, "hole has wrong Y pos"); Assert.AreApproximatelyEqual(0.8f, hole.scale.x, "hole has wrong X sca"); Assert.AreApproximatelyEqual(0.5f, hole.scale.y, "hole has wrong Y sca"); } if (hole.behaviour.name.Contains("left")) { Assert.AreApproximatelyEqual(1f, hole.position.x, "hole has wrong X pos"); Assert.AreApproximatelyEqual(-0.5f, hole.position.y, "hole has wrong Y pos"); Assert.AreApproximatelyEqual(0.8f, hole.scale.x, "hole has wrong X sca"); Assert.AreApproximatelyEqual(0.5f, hole.scale.y, "hole has wrong Y sca"); } }); this.nodesCreated.Clear(); runCutHoleTest( new Vector3(2.5f, 0.75f, -0.5f), new Vector3(2, 0.5f, 0.8f), (hole) => { if (hole.behaviour.name.Contains("right")) { Assert.AreApproximatelyEqual(0.1f, hole.position.x, "hole has wrong X pos"); Assert.AreApproximatelyEqual(0.125f / 3f, hole.position.y, "hole has wrong Y pos"); Assert.AreApproximatelyEqual(0.16f, hole.scale.x, "hole has wrong X sca"); Assert.AreApproximatelyEqual(0.5f / 3f, hole.scale.y, "hole has wrong Y sca"); } if (hole.behaviour.name.Contains("left")) { Assert.AreApproximatelyEqual(-0.125f, hole.position.x, "hole has wrong X pos"); Assert.AreApproximatelyEqual(-0.075f, hole.position.y, "hole has wrong Y pos"); Assert.AreApproximatelyEqual(0.2f, hole.scale.x, "hole has wrong X sca"); Assert.AreApproximatelyEqual(0.1f, hole.scale.y, "hole has wrong Y sca"); } }); CleanUp(); }