浏览代码

Fix for the tennis Agent. Works with prefab now

/develop-generalizationTraining-TrainerController
vincentpierre 6 年前
当前提交
83158caf
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 14
      UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs

14
UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs


public GameObject ball;
public bool invertX;
public int score;
public GameObject scoreText;
public GameObject opponent;
private Text textComponent;
private Rigidbody agentRb;

{
agentRb = GetComponent<Rigidbody>();
ballRb = GetComponent<Rigidbody>();
textComponent = scoreText.GetComponent<Text>();
var canvas = GameObject.Find("Canvas");
GameObject scoreBoard;
if (invertX)
{
scoreBoard = canvas.transform.Find("ScoreB").gameObject;
}
else
{
scoreBoard = canvas.transform.Find("ScoreA").gameObject;
}
textComponent = scoreBoard.GetComponent<Text>();
}
public override void CollectObservations()

正在加载...
取消
保存