diff --git a/Assets/ML-Agents/Timers/StartScene_timers.json b/Assets/ML-Agents/Timers/StartScene_timers.json
index a05f389..c9480c6 100644
--- a/Assets/ML-Agents/Timers/StartScene_timers.json
+++ b/Assets/ML-Agents/Timers/StartScene_timers.json
@@ -1 +1 @@
-{"count":1,"self":8.25924,"total":8.3077335,"children":{"InitializeActuators":{"count":2,"self":0.0010007,"total":0.0010007,"children":null},"InitializeSensors":{"count":2,"self":0.001501,"total":0.001501,"children":null},"AgentSendState":{"count":151,"self":0.0014988999999999998,"total":0.0125058,"children":{"CollectObservations":{"count":151,"self":0.0090066,"total":0.0090066,"children":null},"WriteActionMask":{"count":151,"self":0.0005009,"total":0.0005009,"children":null},"RequestDecision":{"count":151,"self":0.0014994,"total":0.0014994,"children":null}}},"DecideAction":{"count":151,"self":0.0010014,"total":0.0010014,"children":null},"AgentAct":{"count":151,"self":0.032485,"total":0.032485,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696510666","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken MD8iouPZlC7chsDZh-2OfbaNG8DDnFy36WE1syqyLNg00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"StartScene","end_time_seconds":"1696510675"}}
\ No newline at end of file
+{"count":1,"self":7.6867775999999992,"total":7.7230661,"children":{"InitializeActuators":{"count":2,"self":0.0010014,"total":0.0010014,"children":null},"InitializeSensors":{"count":2,"self":0.0009991,"total":0.0009991,"children":null},"AgentSendState":{"count":133,"self":0.0034961999999999997,"total":0.0112705,"children":{"CollectObservations":{"count":133,"self":0.0063840999999999993,"total":0.0063840999999999993,"children":null},"WriteActionMask":{"count":133,"self":0,"total":0,"children":null},"RequestDecision":{"count":133,"self":0.0013901999999999999,"total":0.0013901999999999999,"children":null}}},"DecideAction":{"count":133,"self":0.0010008,"total":0.0010008,"children":null},"AgentAct":{"count":133,"self":0.022017099999999998,"total":0.022017099999999998,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696516721","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken QYTEq0ishS-kLjhfwMeB2jbrH3uriRLQpQBsjnaTMm000ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"StartScene","end_time_seconds":"1696516728"}}
\ No newline at end of file
diff --git a/Assets/ML-Agents/Timers/Train_timers.json b/Assets/ML-Agents/Timers/Train_timers.json
index d4c54b5..e4c8468 100644
--- a/Assets/ML-Agents/Timers/Train_timers.json
+++ b/Assets/ML-Agents/Timers/Train_timers.json
@@ -1 +1 @@
-{"count":1,"self":7.384512,"total":7.4340082,"children":{"InitializeActuators":{"count":2,"self":0.0010007,"total":0.0010007,"children":null},"InitializeSensors":{"count":2,"self":0.001501,"total":0.001501,"children":null},"AgentSendState":{"count":151,"self":0.0014988999999999998,"total":0.0125058,"children":{"CollectObservations":{"count":151,"self":0.0090066,"total":0.0090066,"children":null},"WriteActionMask":{"count":151,"self":0.0005009,"total":0.0005009,"children":null},"RequestDecision":{"count":151,"self":0.0014994,"total":0.0014994,"children":null}}},"DecideAction":{"count":151,"self":0.0010014,"total":0.0010014,"children":null},"AgentAct":{"count":151,"self":0.032485,"total":0.032485,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696510666","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken MD8iouPZlC7chsDZh-2OfbaNG8DDnFy36WE1syqyLNg00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Train","end_time_seconds":"1696510674"}}
\ No newline at end of file
+{"count":1,"self":6.9184632,"total":6.9552502,"children":{"InitializeActuators":{"count":2,"self":0.0010014,"total":0.0010014,"children":null},"InitializeSensors":{"count":2,"self":0.0009991,"total":0.0009991,"children":null},"AgentSendState":{"count":133,"self":0.0034961999999999997,"total":0.0112705,"children":{"CollectObservations":{"count":133,"self":0.0063840999999999993,"total":0.0063840999999999993,"children":null},"WriteActionMask":{"count":133,"self":0,"total":0,"children":null},"RequestDecision":{"count":133,"self":0.0013901999999999999,"total":0.0013901999999999999,"children":null}}},"DecideAction":{"count":133,"self":0.0010008,"total":0.0010008,"children":null},"AgentAct":{"count":133,"self":0.022017099999999998,"total":0.022017099999999998,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696516721","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken QYTEq0ishS-kLjhfwMeB2jbrH3uriRLQpQBsjnaTMm000ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Train","end_time_seconds":"1696516727"}}
\ No newline at end of file
diff --git a/Assets/TargetLevelProbabilityPanel.cs b/Assets/TargetLevelProbabilityPanel.cs
index 4eae2b3..dedd01e 100644
--- a/Assets/TargetLevelProbabilityPanel.cs
+++ b/Assets/TargetLevelProbabilityPanel.cs
@@ -60,10 +60,14 @@ private void AddEventTrigger(GameObject gameObject, EventTriggerType triggerType
eventTrigger.triggers.Add(entry);
}
+ ///
+ /// On Probability Slider Value Change.Adjust other sliders' value to make sure the total value is 1.
+ ///
+ /// change to this value
+ /// changed panel index
private void OnSliderValueChange(float value, int exceptedIndex)
{
float newTotalValue = 0;
- float averageCorrectionValue = 0;
int unlockedPanelNum = 0;
int remainCorrectionNum = panelNum;
float extraValue = 0;
@@ -97,9 +101,8 @@ private void OnSliderValueChange(float value, int exceptedIndex)
}
// Calculate the average correction value
extraValue = newTotalValue - 1;
- averageCorrectionValue = extraValue / (unlockedPanelNum - 1);
// initialize correction value to each panel
- correctionValues = Enumerable.Repeat(averageCorrectionValue, panelNum).ToArray();
+ correctionValues = Enumerable.Repeat(extraValue / (unlockedPanelNum - 1), panelNum).ToArray();
// make sure all probability value is not less than 0 and equal to 1
int iterationCount = 0;
while (remainCorrectionNum > 0)
@@ -119,6 +122,9 @@ private void OnSliderValueChange(float value, int exceptedIndex)
enableSliderListener();
}
+ ///
+ /// enable all sliders' onValueChanged action listener
+ ///
private void enableSliderListener()
{
for (int i = 0; i < panelNum; i++)
@@ -128,6 +134,9 @@ private void enableSliderListener()
}
}
+ ///
+ /// calculate the correction value to each panel,while the total value is not equal to 1
+ ///
private (float[], int) reCalculateCorrectionValues(float[] correctionValues, int exceptedIndex, float value, float extraValue)
{
int remainCorrectionNum = 0;
@@ -142,8 +151,14 @@ private void enableSliderListener()
correctionValues[i] = singleLevelPanels[i].ProbabilityValue - value;
continue;
}
- // if the panel is locked or the probability value is 0 or the probability value is equal to the correction value
- if (singleLevelPanels[i].IsLocked || singleLevelPanels[i].ProbabilityValue <= 0)
+ // if the panel is locked
+ if (singleLevelPanels[i].IsLocked)
+ {
+ correctionValues[i] = 0;
+ continue;
+ }
+ //if the probability value is 0 or the probability value is equal to the correction value
+ if (singleLevelPanels[i].ProbabilityValue < 0 || singleLevelPanels[i].ProbabilityValue > 1)
{
correctionValues[i] = 0;
}
@@ -151,7 +166,7 @@ private void enableSliderListener()
{
underZeroExtraValueAfterCorrected += correctionValues[i];
}
- else if (singleLevelPanels[i].ProbabilityValue - correctionValues[i] < 0)
+ else if (singleLevelPanels[i].ProbabilityValue - correctionValues[i] < 0 || singleLevelPanels[i].ProbabilityValue - correctionValues[i] > 1)
{
underZeroExtraValueAfterCorrected += correctionValues[i];
correctionValues[i] = singleLevelPanels[i].ProbabilityValue;
@@ -188,6 +203,9 @@ private void enableSliderListener()
return (correctionValues, remainCorrectionNum);
}
+ ///
+ /// applicate correction value to each panel
+ ///
private void applyCorrectionValue(float[] correctionValues)
{
for (int i = 0; i < panelNum; i++)