浏览代码

Add PushBlockTeamManager

/develop/cc-teammanager
Ervin Teng 4 年前
当前提交
9b9613bb
共有 3 个文件被更改,包括 41 次插入0 次删除
  1. 5
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs
  2. 25
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockTeamManager.cs
  3. 11
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockTeamManager.cs.meta

5
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs


PushBlockSettings m_PushBlockSettings;
private int m_NumberOfRemainingBlocks;
private PushBlockTeamManager m_TeamManager;
void Start()
{

item.StartingRot = item.T.transform.rotation;
item.Rb = item.T.GetComponent<Rigidbody>();
}
// Initialize TeamManager
m_TeamManager = new PushBlockTeamManager();
foreach (var item in AgentsList)
{
item.StartingPos = item.Agent.transform.position;

// Add to team manager
item.Agent.SetTeamManager(m_TeamManager);
}
foreach (var item in ZombiesList)
{

25
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockTeamManager.cs


using System.Collections.Generic;
using Unity.MLAgents;
using Unity.MLAgents.Extensions.Teams;
using Unity.MLAgents.Sensors;
public class PushBlockTeamManager : BaseTeamManager
{
List<Agent> m_AgentList = new List<Agent> { };
public override void RegisterAgent(Agent agent)
{
m_AgentList.Add(agent);
}
public override void OnAgentDone(Agent agent, Agent.DoneReason doneReason, List<ISensor> sensors)
{
agent.SendDoneToTrainer();
}
public override void AddTeamReward(float reward)
{
}
}

11
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockTeamManager.cs.meta


fileFormatVersion: 2
guid: f6ff089e647ef48ffbb569d14d170662
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存