浏览代码

Dragon incremental killing reward

/develop/cubewars/splashdamage
Ervin Teng 4 年前
当前提交
e32ab196
共有 2 个文件被更改,包括 14 次插入4 次删除
  1. 11
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  2. 7
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

11
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs


{
if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(fireDamage);
if (hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(fireDamage))
{
AddReward(0.1f);
}
//AddReward(.1f);
}
else if (hit.collider.gameObject.CompareTag("StrongLargeAgent") || hit.collider.gameObject.CompareTag("WeakLargeAgent"))

{
if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(.8f);
//AddReward(.1f);
if (hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(.8f))
{
AddReward(0.1f);
};
}
}
}

7
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs


}
}
public void HitAgent(float damage)
public bool HitAgent(float damage)
{
if (!m_Dead)
{

}
m_HitPoints -= damage;
HealthStatus();
return m_HitPoints <= 0;
}
else
{
return true;
}
}

正在加载...
取消
保存