// Use this for initialization void Start() { IRenderer <Node> nodeRenderer = new NodeRenderer(); IRepository <Node> nodeRepository = new MemoryRepository <Node> (); nodeController = new NodeController(nodeRepository, nodeRenderer); int mockNodes = 997; for (int i = 0; i + 1 <= mockNodes; i++) { Node node = new Node(); node.Position = new Vector3(i * i % 383, i * i % 47, i * i % 173); nodeController.AddNode(node); } nodeController.RenderNodes(); }
void CreateNode() { numNodes++; Debug.Log("Node: " + numNodes); //get node info Vector2 pos = positionalTracker.GetPosition(); int rssi = wifiSignal.GetCurrSignal(); string mac = wifiSignal.GetMacAddress(); //add node info to json string nodeController.AddNode(mac, rssi, pos); //instantiate node Vector3 worldNodePos = new Vector3(pos.x, Camera.main.transform.position.y, pos.y); GameObject node = Instantiate(nodePrefab, worldNodePos, Quaternion.identity); node.transform.position -= new Vector3(0, .1f, 0); string nodeText = "Mac: " + mac + "\n" + "RSSI: " + rssi + "dB"; node.GetComponent <NodeBehavior>().Init(nodeText, numNodes); }