浏览代码

soccer diverged

/asymm-envs
Andrew Cohen 5 年前
当前提交
6f637d7f
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 10
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs
  2. 6
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs

10
Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs


BehaviorParameters m_BehaviorParameters;
Vector3 m_Transform;
private EnvironmentParameters m_ResetParams;
m_Existential = 1f / maxStep;
m_Existential = 1f / MaxStep;
m_BehaviorParameters = gameObject.GetComponent<BehaviorParameters>();
if (m_BehaviorParameters.TeamId == (int)Team.Blue)
{

m_LateralSpeed = 0.3f;
m_ForwardSpeed = 1.3f;
}
else
else
{
m_LateralSpeed = 0.3f;
m_ForwardSpeed = 1.0f;

area.playerStates.Add(playerState);
m_PlayerIndex = area.playerStates.IndexOf(playerState);
playerState.playerIndex = m_PlayerIndex;
m_ResetParams = Academy.Instance.EnvironmentParameters;
}
public void MoveAgent(float[] act)

{
timePenalty = 0;
m_BallTouch = SideChannelUtils.GetSideChannel<FloatPropertiesChannel>().GetPropertyWithDefault("ball_touch", 0);
m_BallTouch = m_ResetParams.GetWithDefault("ball_touch", 0);
if (team == Team.Purple)
{
transform.rotation = Quaternion.Euler(0f, -90f, 0f);

6
Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs


[HideInInspector]
public bool canResetBall;
private EnvironmentParameters m_ResetParams;
void Awake()
{
canResetBall = true;

m_BallController.area = this;
ballStartingPos = ball.transform.position;
m_ResetParams = Academy.Instance.EnvironmentParameters;
}
IEnumerator ShowGoalUI()

ballRb.velocity = Vector3.zero;
ballRb.angularVelocity = Vector3.zero;
var ballScale = SideChannelUtils.GetSideChannel<FloatPropertiesChannel>().GetPropertyWithDefault("ball_scale", 0.015f);
var ballScale = m_ResetParams.GetWithDefault("ball_scale", 0.015f);
ballRb.transform.localScale = new Vector3(ballScale, ballScale, ballScale);
}
}
正在加载...
取消
保存