Add Gun State, fix PPO GAIL class bug
Add Gun state fix PPO GAIL class errors
This commit is contained in:
@@ -79,6 +79,7 @@ public class AgentWithGun : Agent
|
||||
private float LoadDirDateF;
|
||||
private float loadDirTimeF;
|
||||
public bool defaultTPCamera = true;
|
||||
private bool gunReadyToggle = true;
|
||||
private StartSeneData DataTransfer;
|
||||
private UIController UICon;
|
||||
private HistoryRecorder HistoryRec;
|
||||
@@ -357,10 +358,9 @@ public class AgentWithGun : Agent
|
||||
Ray ray = thisCam.ScreenPointToRay(point);
|
||||
RaycastHit hit;
|
||||
Debug.DrawRay(ray.origin, ray.direction * 100, Color.blue);
|
||||
bool isGunReady = gunReady();
|
||||
UICon.updateShootKeyViewer(shoot, isGunReady);
|
||||
UICon.updateShootKeyViewer(shoot, gunReadyToggle);
|
||||
//按下鼠标左键
|
||||
if (shoot != 0 && isGunReady == true)
|
||||
if (shoot != 0 && gunReadyToggle == true)
|
||||
{
|
||||
|
||||
lastShootTime = Time.time;
|
||||
@@ -377,7 +377,7 @@ public class AgentWithGun : Agent
|
||||
shoot = 0;
|
||||
return shootReward;
|
||||
}
|
||||
else if (shoot != 0 && isGunReady == false)
|
||||
else if (shoot != 0 && gunReadyToggle == false)
|
||||
{
|
||||
shoot = 0;
|
||||
return shootWithoutReadyReward;
|
||||
@@ -536,6 +536,8 @@ public class AgentWithGun : Agent
|
||||
sensor.AddObservation(rayDisResult); // 探测用RayDis结果 float[](raySensorNum,1)
|
||||
//sensor.AddObservation(focusEnemyObserve); // 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
|
||||
//sensor.AddObservation(raySensorNum); // raySensor数量 int
|
||||
gunReadyToggle = gunReady();
|
||||
sensor.AddObservation(gunReadyToggle); // save gun is ready?
|
||||
sensor.AddObservation(LoadDirDateF); // 用于loadModel的第一级dir
|
||||
sensor.AddObservation(loadDirTimeF); // 用于loadModel的第二级dir
|
||||
sensor.AddObservation(saveNow); // sent saveNow Toggle to python let agent save weights
|
||||
|
||||
Reference in New Issue
Block a user