浏览代码

Try to stop stalling behavior

/develop/teammanager/cubewar-nocycle
Ervin Teng 4 年前
当前提交
d8f86a9c
共有 2 个文件被更改,包括 17 次插入8 次删除
  1. 12
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  2. 13
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

12
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);
AddReward(.1f);
if (hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(fireDamage))
{
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(.1f);
}
}
}
}

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


hit.collider.gameObject.GetComponent<SmallCubeAgent>().HealAgent(m_Heal);
if (role == Role.Healer)
{
AddReward(.1f);
AddReward(.02f);
}
}

if (role == Role.DPS)
{
AddReward(.1f);
AddReward(.02f);
}
}
}

}
}
public void HitAgent(float damage)
public bool HitAgent(float damage) // Returns true if agent dies.
AddReward(.1f);
AddReward(.02f);
return m_HitPoints <= 0;
}
else
{
return true;
}
}

正在加载...
取消
保存