public void SortLeftToRight() { SceneNodeModel a = new SceneNodeModel(); a.x = 1.0f; a.y = 1.0f; a.name = "node_0"; SceneNodeModel b = new SceneNodeModel(); b.x = 2.0f; b.y = 1.0f; b.name = "node_1"; SceneNodeModel c = new SceneNodeModel(); c.x = 2.0f; c.y = 0.0f; c.name = "node_2"; List <SceneNodeModel> nodes = new List <SceneNodeModel>() { c, a, b }; SceneNodeModel.SortLeftToRight(nodes); Assert.AreEqual(a.name, nodes[0].name); Assert.AreEqual(a, nodes[0]); Assert.AreEqual(b.name, nodes[1].name); Assert.AreEqual(b, nodes[1]); Assert.AreEqual(c.name, nodes[2].name); Assert.AreEqual(c, nodes[2]); }
public static List <SceneNodeModel> ToSceneNodeList(List <GameObject> viewObjects) { List <SceneNodeModel> nodes = new List <SceneNodeModel>(); for (int index = 0; index < DataUtil.Length(viewObjects); index++) { SceneNodeModel node = new SceneNodeModel(); GameObject viewObject = viewObjects[index]; node.name = GetName(viewObject); node.x = GetLocalX(viewObject); node.y = GetLocalY(viewObject); nodes.Add(node); } return(nodes); }