浏览代码

update scenes

/develop/superpush/int
Ruo-Ping Dong 4 年前
当前提交
3c5af84d
共有 10 个文件被更改,包括 49 次插入65 次删除
  1. 4
      Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayCollabAgent.cs
  2. 12
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockEnvController.cs
  3. 2
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs
  4. 2
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs.meta
  5. 6
      com.unity.ml-agents.extensions/Runtime/MultiAgent/BaseMultiAgentGroup.cs
  6. 33
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs
  7. 11
      Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs.meta
  8. 24
      Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs
  9. 20
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockTeamManager.cs
  10. 0
      /Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs.meta

4
Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayCollabAgent.cs


using UnityEngine;
using Unity.MLAgents.Extensions.Teams;
using Unity.MLAgents.Extensions.MultiAgent;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

base.Initialize();
if (isSpotter)
{
var teamManager = new HallwayTeamManager();
var teamManager = new BaseMultiAgentGroup();
teamManager.RegisterAgent(this);
teamManager.RegisterAgent(teammate);
}

12
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockEnvController.cs


using System.Collections;
using System.Collections.Generic;
using Unity.MLAgents.Extensions.Teams;
using Unity.MLAgents.Extensions.MultiAgent;
using UnityEngine;
public class PushBlockEnvController : MonoBehaviour

private int m_NumberOfRemainingBlocks;
private PushBlockTeamManager m_TeamManager;
private PushBlockAgentGroup m_AgentGroup;
void Start()
{

item.Rb = item.T.GetComponent<Rigidbody>();
}
// Initialize TeamManager
m_TeamManager = new PushBlockTeamManager(this);
m_TeamManager.SetTeamMaxStep(MaxEnvironmentSteps);
m_AgentGroup = new PushBlockAgentGroup(this);
m_AgentGroup.SetGroupMaxStep(MaxEnvironmentSteps);
m_TeamManager.RegisterAgent(item.Agent);
m_AgentGroup.RegisterAgent(item.Agent);
}
ResetScene();

if (done)
{
//Reset assets
m_TeamManager.EndTeamEpisode();
m_AgentGroup.EndGroupEpisode();
}
}

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


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

2
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs.meta


fileFormatVersion: 2
guid: f6ff089e647ef48ffbb569d14d170662
guid: 41293044e9687478d8ca2d7df07ddad4
MonoImporter:
externalObjects: {}
serializedVersion: 2

6
com.unity.ml-agents.extensions/Runtime/MultiAgent/BaseMultiAgentGroup.cs


Reset();
}
public virtual void OnGroupEpisodeBegin()
{
}
OnGroupEpisodeBegin();
}
}
}

33
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs


using System;
using System.Collections.Generic;
using Unity.MLAgents;
using Unity.MLAgents.Extensions.MultiAgent;
using Unity.MLAgents.Sensors;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEngine;
using Unity.Barracuda;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Sensors.Reflection;
using Unity.MLAgents.Demonstrations;
using Unity.MLAgents.Policies;
using UnityEngine.Serialization;
public class PushBlockAgentGroup : BaseMultiAgentGroup
{
PushBlockEnvController m_envController;
Action ResetScene;
public PushBlockAgentGroup(PushBlockEnvController envController)
{
ResetScene = envController.ResetScene;
}
public override void OnGroupEpisodeBegin()
{
ResetScene.Invoke();
}
}

11
Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs.meta


fileFormatVersion: 2
guid: 8b67166b7adef46febf8b570f92c400d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

24
Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs


using System.Collections.Generic;
using Unity.MLAgents;
using Unity.MLAgents.Extensions.Teams;
using Unity.MLAgents.Sensors;
public class HallwayTeamManager : 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)
// {
// }
// public override void AddTeamReward(float reward)
// {
// }
}

20
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
{
PushBlockEnvController m_envController;
public PushBlockTeamManager(PushBlockEnvController envController)
{
m_envController = envController;
}
public override void OnTeamEpisodeBegin()
{
m_envController.ResetScene();
}
}

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

正在加载...
取消
保存