コード例 #1
0
        public void StoreValues()
        {
            Blackboard.ClearBlackboard();

            Assert.IsTrue(Blackboard.NewBlackboard <int>());
            Assert.IsFalse(Blackboard.NewBlackboard <int>());

            Blackboard.AddValueToBlackboard(health, three);
            Blackboard.AddValueToBlackboard(lives, five);
            Blackboard.AddValueToBlackboard(language, german);
            Blackboard.AddValueToBlackboard(data, example);
        }
コード例 #2
0
        public void StackedValues()
        {
            Blackboard.ClearBlackboard();

            Blackboard.AddValueToBlackboard(data, example);
            Blackboard.AddValueToBlackboard(data, new ExampleClass(), 4);

            ExampleClass eTemp1;
            ExampleClass eTemp;
            ExampleClass eTemp2;

            Assert.IsTrue(Blackboard.GetValueFromBlackboard(out eTemp1, data, 0));
            Assert.IsFalse(Blackboard.GetValueFromBlackboard(out eTemp, data, 1));
            Assert.IsFalse(Blackboard.GetValueFromBlackboard(out eTemp, data, 2));
            Assert.IsFalse(Blackboard.GetValueFromBlackboard(out eTemp, data, 3));
            Assert.IsTrue(Blackboard.GetValueFromBlackboard(out eTemp2, data, 4));

            Assert.AreNotEqual(eTemp1, eTemp2);
        }
コード例 #3
0
    void Retest()
    {
        Blackboard.NewBlackboard <int>();
        Blackboard.AddValueToBlackboard("Health", 3.0f);
        Blackboard.AddValueToBlackboard("Lives", 5);
        Blackboard.AddValueToBlackboard("Language", "German");
        Blackboard.AddValueToBlackboard("Player", this.transform);

        float     fTemp;
        int       iTemp;
        string    sTemp;
        Transform tTemp;

        Blackboard.GetValueFromBlackboard(out fTemp, "Health");
        Blackboard.GetValueFromBlackboard(out iTemp, "Lives");
        Blackboard.GetValueFromBlackboard(out sTemp, "Language");
        print("Health: " + fTemp + " | Lives: " + iTemp + " | Language: " + sTemp);

        Blackboard.GetValueFromBlackboard(out tTemp, "Player");
        print(tTemp.ToString());

        if (!Blackboard.GetValueFromBlackboard(out iTemp, "Suns"))
        {
            print("id Suns not set");
        }
        if (!Blackboard.GetValueFromBlackboard(out fTemp, "Lives"))
        {
            print("Lives is an int not an float");
        }
        if (!Blackboard.GetValueFromBlackboard(out sTemp, "English"))
        {
            print("English was not found");
        }
        if (!Blackboard.GetValueFromBlackboard(out tTemp, "Steave"))
        {
            print("the position of Steave was not found");
        }

        Blackboard.AddValueToBlackboard("Player", this.transform, 4);

        sTemp = "";
        if (Blackboard.GetValueFromBlackboard(out tTemp, "Player", 0))
        {
            sTemp += tTemp.ToString() + " ";
        }
        else
        {
            sTemp += "| ";
        }
        if (Blackboard.GetValueFromBlackboard(out tTemp, "Player", 1))
        {
            sTemp += tTemp.ToString() + " ";
        }
        else
        {
            sTemp += "| ";
        }
        if (Blackboard.GetValueFromBlackboard(out tTemp, "Player", 2))
        {
            sTemp += tTemp.ToString() + " ";
        }
        else
        {
            sTemp += "| ";
        }
        if (Blackboard.GetValueFromBlackboard(out tTemp, "Player", 3))
        {
            sTemp += tTemp.ToString() + " ";
        }
        else
        {
            sTemp += "| ";
        }
        if (Blackboard.GetValueFromBlackboard(out tTemp, "Player", 4))
        {
            sTemp += tTemp.ToString() + " ";
        }
        else
        {
            sTemp += "| ";
        }

        print(sTemp);
    }