浏览代码

update scene

/develop/superpush/int
Ruo-Ping Dong 4 年前
当前提交
59a435d3
共有 4 个文件被更改,包括 15 次插入49 次删除
  1. 19
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockEnvController.cs
  2. 1
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs
  3. 33
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs
  4. 11
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockAgentGroup.cs.meta

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


private int m_NumberOfRemainingBlocks;
private PushBlockAgentGroup m_AgentGroup;
private BaseMultiAgentGroup m_AgentGroup;
private int m_ResetTimer;
void Start()
{

item.Rb = item.T.GetComponent<Rigidbody>();
}
// Initialize TeamManager
m_AgentGroup = new PushBlockAgentGroup(this);
m_AgentGroup.SetGroupMaxStep(MaxEnvironmentSteps);
m_AgentGroup = new BaseMultiAgentGroup();
foreach (var item in AgentsList)
{
item.StartingPos = item.Agent.transform.position;

ResetScene();
}
void FixedUpdate()
{
m_ResetTimer += 1;
if (m_ResetTimer >= MaxEnvironmentSteps && MaxEnvironmentSteps > 0)
{
m_AgentGroup.GroupEpisodeInterrupted();
ResetScene();
}
}
/// <summary>

public void ResetScene()
{
// m_ResetTimer = 0;
m_ResetTimer = 0;
//Random platform rot
var rotation = Random.Range(0, 4);

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


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

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/PushBlock/Scripts/PushBlockAgentGroup.cs.meta


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