Update PPO class,add python human control
Python: Update PPO class add python human control Unity: add FP/TP choose button
This commit is contained in:
@@ -19,6 +19,21 @@ public class EnvArgsChanger : MonoBehaviour
|
||||
public Text DecisionPeriodDataText;
|
||||
public Toggle TakeActionsBetweenDecisionsToggle;
|
||||
|
||||
[Header("Lock Mouse")]
|
||||
public Toggle LockMouseToggle;
|
||||
|
||||
[Header("Default Camera")]
|
||||
public Toggle FPToggle;
|
||||
public Text FPText;
|
||||
public Toggle TPToggle;
|
||||
public Text TPText;
|
||||
|
||||
private StartSeneData startSeneData;
|
||||
private void Start()
|
||||
{
|
||||
startSeneData = DataTransfer.GetComponent<StartSeneData>();
|
||||
}
|
||||
|
||||
|
||||
public void onEnemynumValueChanged()
|
||||
{
|
||||
@@ -30,7 +45,7 @@ public class EnvArgsChanger : MonoBehaviour
|
||||
else
|
||||
{
|
||||
EnemyNumText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().EnemyNum = Math.Abs(int.Parse(EnemyNumInput.GetComponent<InputField>().text));
|
||||
startSeneData.EnemyNum = Math.Abs(int.Parse(EnemyNumInput.GetComponent<InputField>().text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,19 +59,48 @@ public class EnvArgsChanger : MonoBehaviour
|
||||
else
|
||||
{
|
||||
TimeLimText.color = Color.yellow;
|
||||
DataTransfer.GetComponent<StartSeneData>().Timelim = Math.Abs(int.Parse(TimelimInput.GetComponent<InputField>().text));
|
||||
startSeneData.Timelim = Math.Abs(int.Parse(TimelimInput.GetComponent<InputField>().text));
|
||||
}
|
||||
}
|
||||
|
||||
public void onDPSlideValueChanged()
|
||||
{
|
||||
// DecisionPeriod(DP) value Control
|
||||
DataTransfer.GetComponent<StartSeneData>().DecisionPeriod = (int)(DecisionPeriodSlide.GetComponent<Slider>().value);
|
||||
DecisionPeriodDataText.text = DataTransfer.GetComponent<StartSeneData>().DecisionPeriod.ToString();
|
||||
startSeneData.DecisionPeriod = (int)(DecisionPeriodSlide.GetComponent<Slider>().value);
|
||||
DecisionPeriodDataText.text = startSeneData.DecisionPeriod.ToString();
|
||||
}
|
||||
public void onABDToggleChanged()
|
||||
{
|
||||
// Actions Between Decisions(ABD) Toggle Control
|
||||
DataTransfer.GetComponent<StartSeneData>().ActionsBetweenDecisions = TakeActionsBetweenDecisionsToggle.isOn;
|
||||
startSeneData.ActionsBetweenDecisions = TakeActionsBetweenDecisionsToggle.isOn;
|
||||
}
|
||||
public void onLockMouseToggleChanged()
|
||||
{
|
||||
// lock mouse or not
|
||||
startSeneData.lockMouse = LockMouseToggle.isOn;
|
||||
}
|
||||
public void onTPCamToggleChanged()
|
||||
{
|
||||
startSeneData.defaultTPCamera = true;
|
||||
|
||||
FPToggle.interactable = true;
|
||||
FPToggle.SetIsOnWithoutNotify(false);
|
||||
FPText.color = Color.gray;
|
||||
|
||||
TPToggle.SetIsOnWithoutNotify(true);
|
||||
TPToggle.interactable = false;
|
||||
TPText.color = Color.green;
|
||||
}
|
||||
public void onFPCameToggleChanged()
|
||||
{
|
||||
startSeneData.defaultTPCamera = false;
|
||||
|
||||
TPToggle.interactable = true;
|
||||
TPToggle.SetIsOnWithoutNotify(false);
|
||||
TPText.color = Color.gray;
|
||||
|
||||
FPToggle.SetIsOnWithoutNotify(true);
|
||||
FPToggle.interactable = false;
|
||||
FPText.color = Color.green;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public class StartSeneData : MonoBehaviour
|
||||
public float killRewardDefault = 10.0f;
|
||||
public float winRewardDefault = 20.0f;
|
||||
public float loseRewardDefault = -10.0f;
|
||||
public bool lockMouse = false;
|
||||
public bool defaultTPCamera = true;
|
||||
|
||||
// LoadDir
|
||||
[System.NonSerialized]public string LoadDirDate = "0";
|
||||
|
||||
Reference in New Issue
Block a user