解决在commit 03267d2 中添加goto模式的facing reward未对play mode适配的问题。

This commit is contained in:
2023-10-25 04:05:50 +09:00
parent 9087a8c552
commit 779897c874
12 changed files with 240 additions and 210 deletions
+7 -7
View File
@@ -131,31 +131,31 @@ public class EnvironmentUIControl : MonoBehaviour
}
// update targetType text
public void UpdateTargetType(int targetInt)
public void UpdateTargetType(Targets targetInt)
{
switch (targetInt)
{
case (int)Targets.Go:
case Targets.Go:
targetTypeText.text = "GOTO";
targetTypeText.color = Color.blue;
break;
case (int)Targets.Attack:
case Targets.Attack:
targetTypeText.text = "Attack!";
targetTypeText.color = Color.red;
break;
case (int)Targets.Defence:
case Targets.Defence:
targetTypeText.text = "Defence";
targetTypeText.color = Color.green;
break;
case (int)Targets.Free:
case Targets.Free:
targetTypeText.text = "Free";
targetTypeText.color = Color.yellow;
break;
case (int)Targets.Stay:
case Targets.Stay:
targetTypeText.text = "Stay";
targetTypeText.color = Color.white;
break;
@@ -169,7 +169,7 @@ public class EnvironmentUIControl : MonoBehaviour
// update state text
// public TextMeshProUGUI stateText;
// targetState[0] = targetTypeInt;
// targetState[0] = targetType;
// targetState[1] = targetEndPosition.x / raySensors.viewDistance; // normalization
// targetState[2] = targetEndPosition.y / raySensors.viewDistance;
// targetState[3] = targetEndPosition.z / raySensors.viewDistance;
+13 -12
View File
@@ -26,32 +26,33 @@ public class WorldUIController : MonoBehaviour
}
}
public void UpdateChart(int targetType, int endType)
public void UpdateChart(Targets targetType, int endType)
{
float winRatio = 0f;
int targetTypeInt = (int)targetType;
switch (endType)
{
case (int)TargetController.EndType.Win:
//Win
totalGames[targetType] += 1;
winGames[targetType] += 1;
winRatio = (float)winGames[targetType] / totalGames[targetType];
winChart.AddData(targetType, winRatio);
if (totalGames[targetType] > maxXAxis)
totalGames[targetTypeInt] += 1;
winGames[targetTypeInt] += 1;
winRatio = (float)winGames[targetTypeInt] / totalGames[targetTypeInt];
winChart.AddData(targetTypeInt, winRatio);
if (totalGames[targetTypeInt] > maxXAxis)
{
maxXAxis = totalGames[targetType];
maxXAxis = totalGames[targetTypeInt];
winChart.AddXAxisData(Convert.ToString(maxXAxis));
}
break;
case (int)TargetController.EndType.Lose:
//lose
totalGames[targetType] += 1;
winRatio = (float)winGames[targetType] / totalGames[targetType];
winChart.AddData(targetType, winRatio);
if (totalGames[targetType] > maxXAxis)
totalGames[targetTypeInt] += 1;
winRatio = (float)winGames[targetTypeInt] / totalGames[targetTypeInt];
winChart.AddData(targetTypeInt, winRatio);
if (totalGames[targetTypeInt] > maxXAxis)
{
maxXAxis = totalGames[targetType];
maxXAxis = totalGames[targetTypeInt];
winChart.AddXAxisData(Convert.ToString(maxXAxis));
}
break;