Ejemplo n.º 1
0
 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[,];
 }
Ejemplo n.º 2
0
 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));
 }