// Use this for initialization void Start() { // Don't destroy this object on load DontDestroyOnLoad(gameObject); currentNavigation = NavArray[stringIndex]; s_obj = FindObjectOfType <StudyObject>(); }
// Update is called once per frame void Update() { if (NavArray.Length > 0) { currentNavigation = NavArray[stringIndex]; } if (s_obj == null && initialLoad > 1) { try { s_obj = FindObjectOfType <StudyObject>(); } catch (Exception e) { print("can't find s_obj right now"); } } if (sys != null) { this.ParticipantID = sys.PID.text; this.NavArray = sys.NavArray; this.TaskArray = sys.TaskArrayInt; this.DataArray = sys.DataArrayInt; this.HandOrientArray = sys.HandOrientArray; } if (Input.GetKeyDown(KeyCode.KeypadEnter)) { print("Level Reload"); SceneManager.LoadScene(1); if (initialLoad > 1) { s_obj.createCSV(); stringIndex++; if (stringIndex > -1) { currentNavigation = NavArray[stringIndex]; } } } }
private AnalysisObject ParseStaticVariables(StudyObject objectXml, AnalysisObject analysisObject) { // variables used during parsing of the data Vector3 staticPosition = Vector3.zero; Vector3 staticScale = Vector3.one; Quaternion staticRotation = Quaternion.identity; bool useStaticPosition = false; bool useStaticScale = false; bool useStaticRotation = false; float unitScaleFactor = analysisObject.UnitConversionFactor; if (objectXml.PositionXSource.Length == 0 || objectXml.PositionYSource.Length == 0 || objectXml.PositionZSource.Length == 0) { staticPosition = Vector3.zero; useStaticPosition = true; } else if (IsLiteral(objectXml.PositionXSource) && IsLiteral(objectXml.PositionYSource) && IsLiteral(objectXml.PositionZSource)) { staticPosition = ParseStaticPosition(objectXml.PositionXSource, objectXml.PositionYSource, objectXml.PositionZSource, unitScaleFactor); useStaticPosition = true; } if (objectXml.ScaleXSource.Length == 0 || objectXml.ScaleYSource.Length == 0 || objectXml.ScaleZSource.Length == 0) { staticScale = Vector3.one; useStaticScale = true; } else if (IsLiteral(objectXml.ScaleXSource) && IsLiteral(objectXml.ScaleYSource) && IsLiteral(objectXml.ScaleZSource)) { staticScale = ParseStaticScale(objectXml.ScaleXSource, objectXml.ScaleYSource, objectXml.ScaleZSource); useStaticScale = true; } if (objectXml.RotationXSource.Length == 0 || objectXml.RotationYSource.Length == 0 || objectXml.RotationZSource.Length == 0) { staticRotation = Quaternion.identity; useStaticRotation = true; } else if (objectXml.RotationWSource.Length == 0) { if (IsLiteral(objectXml.RotationXSource) && IsLiteral(objectXml.RotationYSource) && IsLiteral(objectXml.RotationZSource)) { staticRotation = ParseStaticRotation(objectXml.RotationXSource, objectXml.RotationYSource, objectXml.RotationZSource, objectXml.RotationFormat); useStaticRotation = true; } } else { if (IsLiteral(objectXml.RotationWSource) && IsLiteral(objectXml.RotationXSource) && IsLiteral(objectXml.RotationYSource) && IsLiteral(objectXml.RotationZSource)) { staticRotation = ParseStaticRotation(objectXml.RotationWSource, objectXml.RotationXSource, objectXml.RotationYSource, objectXml.RotationZSource); useStaticRotation = true; } } // assign static data to analysis object analysisObject.UseStaticPosition = useStaticPosition; analysisObject.UseStaticRotation = useStaticRotation; analysisObject.UseStaticScale = useStaticScale; analysisObject.LocalPosition = staticPosition; analysisObject.LocalRotation = staticRotation; analysisObject.LocalScale = staticScale; return(analysisObject); }