예제 #1
0
        /// <summary>
        /// Initializes strings from SystemFunctionTestClass resources
        /// </summary>
        /// <param name="BTPara">BT device names list will need to be scaned.
        /// If users configure the BT devices list and scan time on SFTConfig.xml, this test will be auto-judge pass/fail.</param>
        private void BTScan(string[] BTPara)
        {
            string        BTInfo;
            bool          bFlag     = false;
            CoreComponent component = null;

            try
            {
                component = new CoreComponent();
                BTInfo    = component.TestBT(TestDuration);
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }

            char[]   tok   = new Char[] { '\n' };
            string[] split = BTInfo.Split(tok, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < split.Length; i++)
            {
                this.BTInFoList.Items.Add(split[i]);
                this.BTInFoList.Items.Add("\n");
                Log.LogComment(DllLog.Log.LogLevel.Info, "Scaned BT device: " + split[i]);
            }

            if (BTPara != null) // If BTlist para is not empty, test item will auto-judge pass/fail
            {
                for (int i = 0; i < BTPara.Length; i++)
                {
                    if (BTInfo.IndexOf(BTPara[i], StringComparison.Ordinal) >= 0)
                    {
                        bFlag = true;
                    }
                    else
                    {
                        bFlag = false;
                        break;
                    }
                }
                if (bFlag)
                {
                    Program.ExitApplication(0);
                }
                else
                {
                    Program.ExitApplication(255);
                }
            }
        }
예제 #2
0
        static BTInfo CreateBtInfo(int id)
        {
            //return LoadBehaviorTreeDemo();
            var textAsset = Resources.Load <TextAsset>(relResPath + id);
            var bytes     = textAsset.bytes;
            //var path = PathUtil.GetUnityPath(relPath + id + BTFactory.FileExt);
            //var bytes = File.ReadAllBytes(path);
            var info = BTInfo.Deserialize(bytes, BTFactoryAI.CreateNode);

            return(info);
        }
예제 #3
0
        static BTInfo LoadBehaviorTreeDemo()
        {
            var info = new BTInfo();

            info.Id          = 0;
            info.Description = "asdfasf";
            BTFactory.BeforeCreateNode();
            var bt = Create <BTActionPrioritizedSelector>();

            bt
            .AddChild(Create <BTActionSequence>()
                      .SetPrecondition((BTPreconditionNot)Create <BTPreconditionNot>()
                                       .AddChild(Create <CON_HasReachedTarget>()))
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_MoveTo>()))
            .AddChild(Create <BTActionSequence>()
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_Attack>()));
            info.RootNode = bt;
            info.Init();
            return(info);
        }
예제 #4
0
 public static BTInfo GetBehaviorTreeDemo1()
 {
     return(_bevTreeDemo1 ?? (_bevTreeDemo1 = CreateBtInfo()));
 }