コード例 #1
0
ファイル: NodeTest.cs プロジェクト: Greg-Rus/Linker
 public void Init()
 {
     testNetworkObject = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath ("Assets/Prefabs/Network.prefab", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject;
     testNetwork = testNetworkObject.GetComponent<Network> ();
     testNetworkProbe = new Probe<Network> (testNetwork);
     testNetwork.initialize (3, 3);
     map = testNetworkProbe.getField ("networkMap") as NodeController[,];
 }
コード例 #2
0
ファイル: NodeTest.cs プロジェクト: Greg-Rus/Linker
 public void addNeighbourTest()
 {
     INode testNode = map [1, 1];
     Vector2 testNeighbourLocalCoordinates = new Vector2 (1, 0);
     INode testNeighbour = map [2, 1];
     testNode.addNeighbour (testNeighbour);
     Probe<NodeController> testNodeProbe = new Probe<NodeController> (map[1,1]);
     NodeModel testNodeModel = testNodeProbe.getField ("nodeModel") as NodeModel;
     Assert.NotNull (testNodeModel);
     Assert.IsTrue (testNodeModel.neighbours.ContainsKey (testNeighbourLocalCoordinates));
     Assert.IsTrue (testNodeModel.neighbours.ContainsValue (testNeighbour));
     Vector2 incorrectNeighbourLocation = new Vector2 (0, 1);
     Assert.IsFalse (testNodeModel.neighbours.ContainsKey (incorrectNeighbourLocation));
 }