|
|
|
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|