浏览代码

Instantiate reward provider earlier.

/main/reward-providers
Christopher Goy 5 年前
当前提交
fbc37fe7
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 2
      UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
  2. 7
      UnitySDK/Assets/ML-Agents/Scripts/RewardProvider/LowLevelRewardProviderComponent.cs

2
UnitySDK/Assets/ML-Agents/Scripts/Agent.cs


void OnEnable()
{
m_Id = gameObject.GetInstanceID();
InitializeRewardProvider();
var academy = FindObjectOfType<Academy>();
academy.LazyInitialization();
OnEnableHelper(academy);

academy.DecideAction += DecideAction;
academy.AgentAct += AgentStep;
academy.AgentForceReset += _AgentReset;
InitializeRewardProvider();
m_PolicyFactory = GetComponent<BehaviorParameters>();
m_Brain = m_PolicyFactory.GeneratePolicy(Heuristic, m_RewardProviderComponent.GetRewardProvider());
ResetData();

7
UnitySDK/Assets/ML-Agents/Scripts/RewardProvider/LowLevelRewardProviderComponent.cs


{
return m_RewardProvider;
}
void Awake()
{
m_RewardProvider = new LowLevelRewardProvider();
}
m_RewardProvider = new LowLevelRewardProvider();
GetRewardProvider().OnRewardProviderReset += RewardReset;
}

正在加载...
取消
保存