private void UpdateLastSimulationSets(SimulationEndStatus status) { if (status == SimulationEndStatus.SUCCESS) { resultsOfLastTrackedSimsSmallSet[lastTrackedSimsSmallSetIndex] = 1; resultsOfLastTrackedSimsLargeSet[lastTrackedSimsLargeSetIndex] = 1; } else { resultsOfLastTrackedSimsSmallSet[lastTrackedSimsSmallSetIndex] = 0; resultsOfLastTrackedSimsLargeSet[lastTrackedSimsLargeSetIndex] = 0; } lastTrackedSimsSmallSetIndex++; lastTrackedSimsLargeSetIndex++; if (lastTrackedSimsSmallSetIndex >= numLastSimsToTrackSmallSet) { lastTrackedSimsSmallSetIndex = 0; } if (lastTrackedSimsLargeSetIndex >= numLastSimsToTrackLargeSet) { lastTrackedSimsLargeSetIndex = 0; } }
private void OnSimulationEnd(SimulationEndStatus status) { totalSimulations++; if (status == SimulationEndStatus.SUCCESS) { totalSuccessCount++; } else { totalFailCount++; } totalSuccessRate = 100f * totalSuccessCount / totalSimulations; UpdateLastSimulationSets(status); PrintSimsSmallSetStatsIfRequired(); PrintSimsLargeSetStatsIfRequired(); if (totalSimulations % numLastSimsToTrackLargeSet == 0) { EventManager.RaiseTrainingLargeSetStatsUpdatedEvent(successRateOfLastSimsLargeSet, numLastSimsToTrackLargeSet); } EventManager.RaiseTrainingTotalStatsUpdatedEvent(totalSimulations, totalSuccessCount, totalFailCount, totalSuccessRate); }
private void OnSimulationEnd(SimulationEndStatus status) { if (status == SimulationEndStatus.SUCCESS) { ShowEndGameText(successTextView, successMessage); } else { ShowEndGameText(failureTextView, GetFailureMessage(status)); } }
private string GetFailureMessage(SimulationEndStatus status) { if (status == SimulationEndStatus.FAILURE_PLANET_COLLISION) { return(failureMessagePrefix + "Planet Collision"); } else if (status == SimulationEndStatus.FAILURE_DEATH_ZONE_COLLISION) { return(failureMessagePrefix + "DeathZone Collision"); } else { Debug.LogFormat("{0}: GetFailureMessage: unexpected SimulationFinishStatus: {1}", LOG_TAG, status); return(null); } }
public static void RaiseSimulationEndEvent(SimulationEndStatus status) { OnSimulationEnd?.Invoke(status); }