浏览代码

Rename private property. Assert that the component isn't null.

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

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


/// </summary>
public IRewardProvider rewardProvider
{
get { return m_RewardProviderComponent.GetRewardProvider(); }
get
{
Debug.Assert(m_RewardProviderComponent != null,
nameof(m_RewardProviderComponent) + " != null");
return m_RewardProviderComponent.GetRewardProvider();
}
public CumulativeRewardProvider defaultRewardProvider
CumulativeRewardProvider DefaultRewardProvider
{
get { return rewardProvider as CumulativeRewardProvider; }
}

/// </summary>
public void ResetReward()
{
Debug.Assert(defaultRewardProvider != null, "the defaultRewardProvider is null and " +
Debug.Assert(DefaultRewardProvider != null, "the DefaultRewardProvider is null and " +
defaultRewardProvider.ResetReward(m_Done);
DefaultRewardProvider.ResetReward(m_Done);
}
/// <summary>

/// <param name="reward">The new value of the reward.</param>
public void SetReward(float reward)
{
Debug.Assert(defaultRewardProvider != null, "the defaultRewardProvider is null and " +
Debug.Assert(DefaultRewardProvider != null, "the DefaultRewardProvider is null and " +
defaultRewardProvider.SetReward(reward);
DefaultRewardProvider.SetReward(reward);
}
/// <summary>

public void AddReward(float increment)
{
Debug.Assert(defaultRewardProvider != null, "the defaultRewardProvider is null and " +
Debug.Assert(DefaultRewardProvider != null, "the DefaultRewardProvider is null and " +
defaultRewardProvider.AddReward(increment);
DefaultRewardProvider.AddReward(increment);
}
/// <summary>

正在加载...
取消
保存