public void AddRoute(PlayerRoute routeToAdd, script_player_controls playerShipVars, string captainsLog) { this.routeLog.Add(routeToAdd); Debug.Log("Getting called 3...." + routeToAdd.theRoute[0].x + " " + routeToAdd.theRoute[0].z); AddCargoManifest(playerShipVars.ship.cargo); AddOtherAttributes(playerShipVars, captainsLog, routeToAdd); }
public void AddOtherAttributes(script_player_controls playerShipVars, string captainsLog, PlayerRoute currentRoute) { string CSVstring = ""; Ship playerShip = playerShipVars.ship; //Add the applicable port docking info //If it isn't -1, then it's a port stop if (currentRoute.settlementID != -1) { CSVstring += "," + currentRoute.isLeaving + "," + currentRoute.settlementID + "," + currentRoute.settlementName; } else { CSVstring += "," + -1 + "," + -1 + "," + -1; } //Add the crewID's CSVstring += ","; for (int index = 0; index < playerShip.crewRoster.Count; index++) { //Debug.Log ("ID: " + playerShip.crewRoster[index].ID); CSVstring += playerShip.crewRoster[index].ID; if (index < playerShip.crewRoster.Count - 1) { CSVstring += "_"; } } //Add the Unity XYZ coordinate of ship Vector3 playerLocation = playerShipVars.transform.position; CSVstring += "," + playerLocation.x + "_" + playerLocation.y + "_" + playerLocation.z; //Add the current questleg CSVstring += "," + playerShip.mainQuest.currentQuestSegment; //Add Ship HP CSVstring += "," + playerShip.health; //Add Player Clout CSVstring += "," + playerShip.playerClout; //Add Player Networks CSVstring += ","; for (int index = 0; index < playerShip.networks.Count; index++) { CSVstring += playerShip.networks[index]; if (index < playerShip.networks.Count - 1) { CSVstring += "_"; } } //Add Days Starving CSVstring += "," + playerShipVars.numOfDaysWithoutProvisions; //Add Days Thirsty CSVstring += "," + playerShipVars.numOfDaysWithoutWater; //Add currency CSVstring += "," + playerShip.currency; //Add Loan Amount Owed if (playerShip.currentLoan != null) { CSVstring += "," + playerShip.currentLoan.amount; } else { CSVstring += ",-1"; } //Add Loan Origin City if (playerShip.currentLoan != null) { CSVstring += "," + playerShip.currentLoan.settlementOfOrigin; } else { CSVstring += ",-1"; } //Add Current Navigator Target CSVstring += "," + playerShip.currentNavigatorTarget; //Add the list of known settlements in the player's acquired journal settlement knowledge CSVstring += ","; //Debug.Log (CSVstring); foreach (int settlementID in playerShip.playerJournal.knownSettlements) { CSVstring += settlementID + "_"; } //remove trailing '_' from list of known settlements CSVstring = CSVstring.Remove(CSVstring.Length - 1); //Debug.Log ("After substring: " + CSVstring); //Add Captains Log: first we need to switch commas in the log to a "|" so it doesn't hurt the delimeters TODO This could be nicer but is fine for now until we get a better database setup //--also need tp scrub newlines string scrubbedLog = captainsLog.Replace(',', '^'); scrubbedLog = scrubbedLog.Replace('\n', '*'); CSVstring += "," + scrubbedLog; CSVstring += "," + playerShip.upgradeLevel; CSVstring += "," + playerShip.crewCapacity; CSVstring += "," + playerShip.cargo_capicity_kg; //Add a new row to match the route of all these attributes this.otherAttributes.Add(CSVstring); }