// Use this for initialization void Start() { GameObject SceneParameterManagerControllerObject = GameObject.FindWithTag("SceneParameterManager"); if (SceneParameterManagerControllerObject != null) { SceneParameterManagerController = SceneParameterManagerControllerObject.GetComponent <SceneParameterManager> (); } else { Debug.Log("GameController: Can not find SceneParameterManager!"); } System.DateTime[] time_record = SceneParameterManagerController.GetSceneArguments(); Debug.Log("In FinishScene: "); for (int i = 0; i < time_record.Length; i++) { time_display [i].text = time_record [i].ToString(); Debug.Log(time_record [i]); } // System.Threading.Thread.Sleep (5000); // #if UNITY_EDITOR // // Application.Quit() does not work in the editor so // // UnityEditor.EditorApplication.isPlaying need to be set to false to end the game // UnityEditor.EditorApplication.isPlaying = false; // #else // Application.Quit(); // #endif }
// Use this for initialization void Start() { // Debug.Log ("Newly start!"); // setMoverioController (); GameObject wrenchFittingObject = GameObject.FindWithTag("WrenchFitting"); if (wrenchFittingObject != null) { wireframe_renderer = wrenchFittingObject.GetComponent <MeshRenderer> (); } standard_shader = Shader.Find("Standard"); wireframe_shader = Shader.Find("Digicrafts/Wireframe/Unlit/Transparent Cutout"); start_vibration_coroutine = startVibration(); stop_vibration_coroutine = stopVibration(); if (haptic) { hapticFeedback = true; } else { hapticFeedback = false; } time_record [2 * (round_index - 1)] = System.DateTime.Now; // Debug.Log (System.DateTime.Now); Debug.Log("round_index: " + round_index); OscDataReceiver.Instance.setChangeSmoothPos(changeSmoothPos); // GameObject drillCombinationObject = GameObject.FindWithTag ("DrillCombination"); // if (drillCombinationObject != null) { // drillCombinationController_placementAroundACircle = drillCombinationObject.GetComponent<PlacementAroundACircle> (); // drillCombinationController_placementAroundACircle.setRadius (radius); // // drillCombinationController_simplePositionMovement = drillCombinationObject.GetComponent<SimplePositionMovement> (); // drillCombinationController_simplePositionMovement.setReference (localReference); // } else { // if (openOutput) { // Debug.Log ("GameController: can not find drillCombinationController_circle"); // } // } GameObject handleObject = GameObject.FindWithTag("Handle"); if (handleObject != null) { handleController_simplePositionMovement = handleObject.GetComponent <SimplePositionMovement> (); handleController_simplePositionMovement.setReference(localReference); } else { if (openOutput) { Debug.Log("GameController: can not find handleController_simplePositionMovement"); } } GameObject triggerObject = GameObject.FindWithTag("Trigger"); if (triggerObject != null) { triggerController = triggerObject.GetComponent <TwoAngleRotation> (); triggerController.setRotationSpeed(triggerRotationSpeed); triggerController.setRotationDiff(triggerRotationDiff); triggerController.setRotationAxis(triggerRotationAxis); } else { if (openOutput) { Debug.Log("GameController: can not find triggerController"); } } GameObject rotationTriggerObject = GameObject.FindWithTag("RotationTrigger"); if (rotationTriggerObject != null) { rotationTriggerController = rotationTriggerObject.GetComponent <TwoPointsMovement> (); rotationTriggerController.setMovementSpeed(rotationTriggerMovementSpeed); rotationTriggerController.setPosDiff(rotationTriggerPosDiff); } else { if (openOutput) { Debug.Log("GameController: can not find rotationTriggerController"); } } GameObject airRegulatorObject = GameObject.FindWithTag("AirRegulator"); if (airRegulatorObject != null) { airRegulatorController = airRegulatorObject.GetComponent <FixedAngleRotation> (); airRegulatorController.setRotationSpeed(airRegulatorRotationSpeed); airRegulatorController.setRotationDiff(airRegulatorRotationDiff); airRegulatorController.setRotationAxis(airRegulatorRotationAxis); } else { if (openOutput) { Debug.Log("GameController: can not find airRegulatorController"); } } GameObject drillBitObject = GameObject.FindWithTag("DrillBit"); if (drillBitObject != null) { drillBitController = drillBitObject.GetComponent <Rotation> (); drillBitController.setRotationAxis(drillBitRotationAxis); } else { if (openOutput) { Debug.Log("GameController: can not find drillBitController"); } } for (int i = 0; i < subtask_cnt; i++) { GameObject flangeNutObject = GameObject.FindWithTag(flangenut_tags [i]); if (flangeNutObject != null) { flangeNut_Rotation [i] = flangeNutObject.GetComponent <flangeNutRotation> (); flangeNut_Rotation [i].setRotationAxis(drillBitRotationAxis); } else { if (openOutput) { Debug.Log("GameController: can not find flangeNut_Rotation " + i); } } if (flangeNutObject != null) { FlangeNut_simplePositionMovement [i] = flangeNutObject.GetComponent <flangeNutSimplePositionMovement> (); FlangeNut_simplePositionMovement [i].setReference(localReference); } else { if (openOutput) { Debug.Log("GameController: can not find FlangeNut_simplePositionMovement " + i); } } } wrenchFittingObject = GameObject.FindWithTag("WrenchFitting"); if (wrenchFittingObject != null) { wrenchFittingController = wrenchFittingObject.GetComponent <DetectCollision> (); } else { if (openOutput) { Debug.Log("GameController: can not find wrenchFittingController"); } } if (OSCControl) { GameObject OSCDataReceiverObject = GameObject.FindWithTag("OSCDataReceiver"); if (OSCDataReceiverObject != null) { OSCDataReceiverController = OSCDataReceiverObject.GetComponent <OscDataReceiver> (); } } GameObject OSCDataSenderObject = GameObject.FindWithTag("OSCDataSender"); if (OSCDataSenderObject != null) { OSCDataSenderController = OSCDataSenderObject.GetComponent <OscDataSender> (); } for (int i = 0; i < subtask_cnt; i++) { GameObject FlangeNutStateObject = GameObject.FindWithTag("flangenut_" + (char)(i + '0')); if (FlangeNutStateObject != null) { FlangeNutStateController [i] = FlangeNutStateObject.GetComponent <FlangeNutState> (); } else { Debug.Log("flangeNutRotation: can not find FlangeNutStateController " + (char)(i + '0')); } } GameObject GameControllerObject = GameObject.FindWithTag("GameController"); if (GameControllerObject != null) { OutputSystemController = GameControllerObject.GetComponent <OutputSystem> (); Debug.Log("GameController: Set OutputSystem!"); } else { Debug.Log("GameController: Can not find OutputSystem!"); } for (int i = 0; i < subtask_cnt; i++) { string tmp = "arrow_indicator_" + (char)(i + '0'); Debug.Log(tmp); current_arrow_indicator [i] = GameObject.FindWithTag(tmp); } GameObject SceneParameterManagerControllerObject = GameObject.FindWithTag("SceneParameterManager"); if (SceneParameterManagerControllerObject != null) { SceneParameterManagerController = SceneParameterManagerControllerObject.GetComponent <SceneParameterManager> (); } else { Debug.Log("GameController: Can not find SceneParameterManager!"); } GameObject soundManagerControllerObject = GameObject.FindWithTag("SoundManager"); if (soundManagerControllerObject != null) { soundManagerController = soundManagerControllerObject.GetComponent <SoundManager> (); } else { Debug.Log("GameController: Can not find SoundManager!"); } _2DCamera = GameObject.FindWithTag("2DCamera"); // if (cameraObject != null) { // _2DCamera = cameraObject.GetComponent<Camera> (); // } else { // Debug.Log ("_2DCamer: Can not find 2DCamera!"); // } if (!randomize_order) { subtask_order = subtask_order_array [0]; } else { int rand = Random.Range(1, subtask_order_array.GetLength(0)); // Debug.Log ("subtask_order_array.GetLength (0): " + subtask_order_array.GetLength (0)); // Debug.Log ("rand: " + rand); subtask_order = subtask_order_array [rand]; } // Debug.Log ("subtask_order: " + subtask_order); }