浏览代码

Add TeamManager

/develop/cubewars/splashdamage
Ervin Teng 4 年前
当前提交
f487b0a4
共有 2 个文件被更改,包括 27 次插入0 次删除
  1. 12
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarArea.cs
  2. 15
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarsTeamManager.cs

12
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarArea.cs


[HideInInspector]
public LargeCubeAgent[] largeAgents;
public float range;
private CubeWarsTeamManager m_SmallTeamManager;
private CubeWarsTeamManager m_LargeTeamManager;
m_SmallTeamManager = new CubeWarsTeamManager();
m_LargeTeamManager = new CubeWarsTeamManager();
foreach (var agent in smallAgents)
{
agent.SetTeamManager(m_SmallTeamManager);
}
foreach (var agent in largeAgents)
{
agent.SetTeamManager(m_LargeTeamManager);
}
}
public void AgentDied()

15
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarsTeamManager.cs


using System.Collections.Generic;
using Unity.MLAgents;
using Unity.MLAgents.Extensions.Teams;
using Unity.MLAgents.Sensors;
public class CubeWarsTeamManager : BaseTeamManager
{
List<Agent> m_AgentList = new List<Agent> { };
public override void RegisterAgent(Agent agent)
{
m_AgentList.Add(agent);
}
}
正在加载...
取消
保存