void Awake() { Application.runInBackground = true; properties = GetComponent <Properties>(); try { properties.load(location); } catch (NegativeRuntimeException e) { Debug.LogException(e); strategicExit(); } _negativeSpace = GetComponent <NegativeSpace>(); _projection = Camera.main.GetComponent <PerspectiveProjection>(); _surfaceRequestListener = GetComponent <SurfaceRequestListener>(); _surfaceRequestListener.StartReceive(); GetComponent <SurfaceRequest>().request(); _udpBodiesListener = GameObject.Find("BodiesManager").GetComponent <UdpBodiesListener>(); _bodies = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); _udpBodiesListener.startListening(int.Parse(properties.localSetupInfo.trackerBroadcastPort)); }
void _init() { _main = GetComponent <Main>(); _networkView = GetComponent <NetworkView>(); _negativeSpace = GetComponent <NegativeSpace>(); _properties = GetComponent <Properties>(); _log = GetComponent <VisualLog>(); _running = true; }
void Start() { workspace = this.gameObject.GetComponent <NegativeSpace>() as NegativeSpace; networkView = GetComponent <NetworkView>(); NSProperties p = GameObject.Find("Main").GetComponent <NSProperties>(); _address = p.remote_NegativeSpaceMachine_Address; _port = p.RPC_Port; }
void Awake() { Application.runInBackground = true; _surfaceRequestListener = GetComponent <SurfaceRequestListener>(); _properties = GetComponent <Properties>(); _log = GetComponent <VisualLog>(); _negativeSpace = GetComponent <NegativeSpace>(); _bodiesListener = GameObject.Find("BodiesManager").GetComponent <UdpBodiesListener>(); _bodies = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); _prespectiveProjection = Camera.main.GetComponent <PerspectiveProjection>(); _tracker = GameObject.Find("RavatarManager").GetComponent <Tracker>(); _tcpKinectListener = GameObject.Find("RavatarManager").GetComponent <TcpKinectListener>(); _workspace = GetComponent <RPCWorkspace>(); _properties.load(); ConfigLoaded = _properties.ConfigLoaded; if (!ConfigLoaded) { _log.Show = true; } else { _log.WriteLine(this, "Config Loaded"); _surfaceRequestListener.StartReceive(); } if (location == Location.A) { _workspace.InitServer(); } else { _workspace.InitClient(); } }
public void Init() { _evalResultsDir = Application.dataPath + "/Results"; _loadSolutions(); _checkerboardLogger = new CheckerboardLogger(10); _main = GameObject.Find("Main").GetComponent <Main>(); colorBlind = _main.location == Location.Assembler ? true : false; if (colorBlind) { blueCube.GetComponent <Highlight>().setMaterials(colorBlindMaterial, colorBlindHighlightMaterial, colorBlindSelected); greenCube.GetComponent <Highlight>().setMaterials(colorBlindMaterial, colorBlindHighlightMaterial, colorBlindSelected); pinkCube.GetComponent <Highlight>().setMaterials(colorBlindMaterial, colorBlindHighlightMaterial, colorBlindSelected); redCube.GetComponent <Highlight>().setMaterials(colorBlindMaterial, colorBlindHighlightMaterial, colorBlindSelected); yellowCube.GetComponent <Highlight>().setMaterials(colorBlindMaterial, colorBlindHighlightMaterial, colorBlindSelected); } boardMap = new GameObject[boardWidth, boardDepth]; for (int i = 0; i < boardWidth; i++) { for (int j = 0; j < boardDepth; j++) { if (i >= boardWidth) { i = 0; } if (j >= boardDepth) { j = 0; } GameObject go = Instantiate(_instantiateDark ? boardDarkPiece : boardLightPiece, transform); // hehe isto só funciona com boardDepth impares :D boardMap[i, j] = go; go.name = "box(" + i + "," + j + ")"; _instantiateDark = !_instantiateDark; go.transform.position = new Vector3(j - boardDepth / 2, 0, i - boardWidth / 2); } } moveUp = blueCube.transform.localScale.y / 2f; GameObject negativeSpaceCenter = GameObject.Find("NegativeSpaceCenter"); NegativeSpace negativeSpace = GameObject.Find("Main").GetComponent <NegativeSpace>(); transform.position = negativeSpace.bottomCenterPosition + 0.001f * negativeSpaceCenter.transform.up; transform.rotation = negativeSpaceCenter.transform.rotation; moveUp = moveUp * scaleFactor; Debug.Log(this.ToString() + ": Scaling to " + scaleFactor); transform.localScale = transform.localScale * scaleFactor; string path = Application.dataPath + "/initPositions.txt"; if (System.IO.File.Exists(path)) { String[] lines = System.IO.File.ReadAllLines(path); foreach (string line in lines) { if (line.Contains(" ontopof ")) { string[] s = line.Split(' '); putObjectOnTopOf(GameObject.Find(s[0]), GameObject.Find(s[2])); } } } else { putObjectOnTopOf(blueCube, 0, 0); putObjectOnTopOf(greenCube, 1, 0); putObjectOnTopOf(pinkCube, 2, 0); putObjectOnTopOf(redCube, 3, 0); putObjectOnTopOf(yellowCube, 4, 0); } if (!System.IO.Directory.Exists(_evalResultsDir)) { System.IO.Directory.CreateDirectory(_evalResultsDir); } _init = true; client = this.GetComponent <CheckerboardClient>(); client.Init(); }