/** * Guarda las posiciones actuales y sus datos en el fichero "backup.txt". (normal|relative) name x y z p r (relativeTo). * @return void */ public void Save() { string[] lines = new string[targetControl.Count()]; // Get positions data for (int i = 0; i < targetControl.Count(); i++) { string aux = ""; TargetModel target = targetControl.GetTarget(i).GetComponent <TargetModel>(); // Relative position? if (target.GetRelativeTo() == null) { aux += NORMAL + " "; aux += target.GetName() + " "; aux += target.GetPositionInScorbot().x + " "; aux += target.GetPositionInScorbot().y + " "; aux += target.GetPositionInScorbot().z + " "; aux += target.GetPitch() + " "; aux += target.GetRoll(); } else { aux += RELATIVE + " "; aux += target.GetName() + " "; aux += target.GetRelativePosInScorbot().x + " "; aux += target.GetRelativePosInScorbot().y + " "; aux += target.GetRelativePosInScorbot().z + " "; aux += target.GetRelativeP() + " "; aux += target.GetRelativeR() + " "; aux += target.GetRelativeTo().GetComponent <TargetModel>().GetName(); } lines[i] = aux; } // Overwrite everything System.IO.File.WriteAllLines(BACKUP_FILE, lines); gameController.backupFileOutput.text = "File saved."; }