feat(ai): BrainGraph 核心程序集 + AiSignal + Blackboard(可自省)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32a983dffef38384280c2ff4b56d7e2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using BaseGames.AI;
|
||||
|
||||
namespace BaseGames.Tests.EditMode.AI
|
||||
{
|
||||
public class BlackboardTests
|
||||
{
|
||||
[Test]
|
||||
public void SetThenGet_ReturnsValue()
|
||||
{
|
||||
var bb = new Blackboard();
|
||||
bb.Set("lastKnown", new Vector2(3f, 4f));
|
||||
Assert.AreEqual(new Vector2(3f, 4f), bb.Get<Vector2>("lastKnown"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_MissingKey_ReturnsDefault()
|
||||
{
|
||||
var bb = new Blackboard();
|
||||
Assert.AreEqual(0f, bb.Get<float>("nope"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Keys_EnumeratesAllSetKeys()
|
||||
{
|
||||
var bb = new Blackboard();
|
||||
bb.Set("a", 1);
|
||||
bb.Set("b", 2);
|
||||
CollectionAssert.AreEquivalent(new[] { "a", "b" }, bb.Keys);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Clear_RemovesAll()
|
||||
{
|
||||
var bb = new Blackboard();
|
||||
bb.Set("a", 1);
|
||||
bb.Clear();
|
||||
CollectionAssert.IsEmpty(bb.Keys);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Snapshot_ReturnsKeyToStringMap_ForIntrospection()
|
||||
{
|
||||
var bb = new Blackboard();
|
||||
bb.Set("hp", 0.5f);
|
||||
var snap = bb.Snapshot();
|
||||
Assert.AreEqual("0.5", snap["hp"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54506ee78297ac6488bbaefbd5678546
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,6 +5,7 @@
|
||||
"BaseGames.Combat.StatusEffects",
|
||||
"BaseGames.Combat",
|
||||
"BaseGames.Core",
|
||||
"BaseGames.AI",
|
||||
"BaseGames.Core.Events",
|
||||
"BaseGames.Core.Save",
|
||||
"BaseGames.EventChain",
|
||||
|
||||
Reference in New Issue
Block a user