浏览代码

Added basic area manager to extensions.

/develop/area-manager
Miguel Alonso Jr 4 年前
当前提交
e472a8a3
共有 4 个文件被更改,包括 45 次插入0 次删除
  1. 3
      com.unity.ml-agents.extensions/Runtime/Utils.meta
  2. 31
      com.unity.ml-agents.extensions/Runtime/Utils/AreaManager.cs
  3. 11
      com.unity.ml-agents.extensions/Runtime/Utils/AreaManager.cs.meta

3
com.unity.ml-agents.extensions/Runtime/Utils.meta


fileFormatVersion: 2
guid: 3857cb2a69864c82805a4b7ea4a65698
timeCreated: 1623095341

31
com.unity.ml-agents.extensions/Runtime/Utils/AreaManager.cs


using System;
using System.Collections;
using System.Collections.Generic;
using Unity.MLAgents;
using UnityEngine;
namespace Unity.MLAgents.Extensions.Utils
{
public class AreaManager : MonoBehaviour
{
public GameObject baseArea;
public int numAreas = 8;
public float separation = 20.0f;
public void Awake()
{
Academy.Instance.OnEnvironmentReset += AddEnvironments;
}
void AddEnvironments()
{
var envParameters = Academy.Instance.EnvironmentParameters;
int numAreas = (int) envParameters.GetWithDefault("num_areas", this.numAreas);
for (int i = 0; i < numAreas - 1; i++)
{
Instantiate(baseArea, new Vector3(0, 0, (i + 1) * separation), Quaternion.identity);
}
}
}
}

11
com.unity.ml-agents.extensions/Runtime/Utils/AreaManager.cs.meta


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