Unity 机器学习代理工具包 (ML-Agents) 是一个开源项目,它使游戏和模拟能够作为训练智能代理的环境。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

40 行
1.1 KiB

using UnityEngine;
using NUnit.Framework;
namespace MLAgents.Tests
{
public class RayPerceptionTests : MonoBehaviour
{
[Test]
public void TestPerception3D()
{
var angles = new[] {0f, 90f, 180f};
var tags = new[] {"test", "test_1"};
var go = new GameObject("MyGameObject");
var rayPer3D = go.AddComponent<RayPerception3D>();
var result = rayPer3D.Perceive(1f, angles, tags);
Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2));
}
[Test]
public void TestPerception2D()
{
var angles = new[] {0f, 90f, 180f};
var tags = new[] {"test", "test_1"};
var go = new GameObject("MyGameObject");
var rayPer2D = go.AddComponent<RayPerception2D>();
var result = rayPer2D.Perceive(1f, angles,
tags);
Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2));
}
[Test]
public void TestConstants()
{
Assert.AreEqual(Physics.DefaultRaycastLayers, Physics2D.DefaultRaycastLayers);
}
}
}