void CallbackOnNewReport(FlightLandingReport report) { string msg = "Report\n"; if (report != null) { msg += "---------------\n"; msg += "HDG " + (100 * report.rewardHeading).ToString("0") + "%\n"; msg += "X " + (100 * report.rewardX).ToString("0") + "%\n"; msg += "BANK " + (100 * report.rewardBank).ToString("0") + "%\n"; msg += "IAS " + (100 * report.rewardIAS).ToString("0") + "%\n"; msg += "VSI " + (100 * report.rewardVSI).ToString("0") + "%\n"; msg += "---------------\n"; msg += "LANDING = " + report.rating.ToString("0.00") + "\n"; msg += "TIME = " + FlightGameManager.instance.totalTimeRewardPenalty.ToString("0.00") + "\n"; msg += "ACTION = " + FlightGameManager.instance.totalActionRewardPenalty.ToString("0.00") + "\n"; msg += "---------------\n"; msg += "TOTAL = " + (report.rating + FlightGameManager.instance.totalTimeRewardPenalty + FlightGameManager.instance.totalActionRewardPenalty).ToString("0.00"); } else { msg += "Unaccetable"; } textField.text = msg; }
float CalculateReward() { // reward if touchdown if (touchedDown) { if (touchDownReport.isWheel && FlightLandingReport.AcceptableZ(airplane.position.z)) { landingReport = new FlightLandingReport( analytics.Heading * Mathf.Deg2Rad, airplane.position.x, analytics.Bank, touchDownReport.relativeVelocity.magnitude, touchDownReport.relativeVelocity.y ); return(landingReport.rating); } else { landingReport = null; return(-1); } } // reward if in step float rewardPenaltyTime = -penaltyTimeCoefficient; totalTimeRewardPenalty += rewardPenaltyTime; if (responseCount > 2) { float rewardPenaltyAction = 0; for (int i = 0; i < actionsOld.Length; i++) { rewardPenaltyAction += -penaltyActionCoefficient *Mathf.Abs(response.actions[i] - actionsOld[i]); } totalActionRewardPenalty += rewardPenaltyAction; return(rewardPenaltyTime + rewardPenaltyAction); } else { return(rewardPenaltyTime); } }