一款基于卡牌的塔防游戏,类似于 Supercell 的《皇室战争》的游戏玩法(简化形式), 可以与“非智能”AI 进行比赛。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

85 行
3.0 KiB

using System.Linq;
using NUnit.Framework;
using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph.UnitTests
{
[TestFixture]
class AbstractMaterialGraphTests
{
private class TestableMNode : AbstractMaterialNode
{}
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[Test]
public void TestCanCreateMaterialGraph()
{
GraphData graph = new GraphData();
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(0, graph.GetNodes<AbstractMaterialNode>().Count());
}
[Test]
public void TestCanAddMaterialNodeToMaterialGraph()
{
GraphData graph = new GraphData();
var node = new TestableMNode();
graph.AddNode(node);
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(1, graph.GetNodes<AbstractMaterialNode>().Count());
}
[Test]
public void TestCanGetMaterialNodeFromMaterialGraph()
{
GraphData graph = new GraphData();
var node = new TestableMNode();
graph.AddNode(node);
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(1, graph.GetNodes<AbstractMaterialNode>().Count());
Assert.AreEqual(node, graph.GetNodeFromGuid(node.guid));
Assert.AreEqual(node, graph.GetNodeFromGuid<TestableMNode>(node.guid));
}
/* [Test]
public void TestCreatePixelShaderGraphWorks()
{
var graph = new UnityEngine.MaterialGraph.MaterialGraph();
Assert.AreEqual(0, graph.GetNodes<AbstractMaterialNode>().Count());
var psn = new MetallicMasterNode();
graph.AddNode(psn);
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(1, graph.GetNodes<AbstractMaterialNode>().Count());
Assert.IsInstanceOf(typeof(MetallicMasterNode), graph.GetNodes<AbstractMaterialNode>().FirstOrDefault());
Assert.IsNotNull(graph.masterNode);
Assert.AreEqual(1, graph.GetNodes<AbstractMaterialNode>().Count());
}
[Test]
public void TestCanAddMultipleMasterNode()
{
var graph = new UnityEngine.MaterialGraph.MaterialGraph();
Assert.AreEqual(0, graph.GetNodes<AbstractMaterialNode>().Count());
var psn = new MetallicMasterNode();
graph.AddNode(psn);
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(1, graph.GetNodes<AbstractMaterialNode>().Count());
var psn2 = new SpecularMasterNode();
graph.AddNode(psn2);
Assert.AreEqual(0, graph.edges.Count());
Assert.AreEqual(2, graph.GetNodes<AbstractMaterialNode>().Count());
}*/
}
}