Esempio n. 1
0
        public void initGlobalTestEnv() {
            BehaviacSystem.Instance.Init();

            GameObject testAgentObject = new GameObject();
            testAgentObject.name = "@UnitTestAgent";
            testAgentObject.transform.localPosition = Vector3.zero;
            testAgentObject.transform.localRotation = Quaternion.identity;
            testAgentObject.transform.localScale = Vector3.one;
            testAgent = testAgentObject.AddComponent<AgentNodeTest>();
            testAgent.init();
        }
Esempio n. 2
0
        public void initGlobalTestEnv()
        {
            BehaviacSystem.Instance.init();

            GameObject testAgentObject = new GameObject();
            testAgentObject.name = "@Agent_0";
            testAgentObject.transform.localPosition = Vector3.zero;
            testAgentObject.transform.localRotation = Quaternion.identity;
            testAgentObject.transform.localScale = Vector3.one;
            parTestAgent = testAgentObject.AddComponent<EmployeeParTestAgent>();
            parTestAgent.init();

            testAgentObject = new GameObject();
            testAgentObject.name = "@NodeTestAgent_1";
            testAgentObject.transform.localPosition = Vector3.zero;
            testAgentObject.transform.localRotation = Quaternion.identity;
            testAgentObject.transform.localScale = Vector3.one;
            nodeTestAgent = testAgentObject.AddComponent<AgentNodeTest>();
            nodeTestAgent.init();

            //			testAgentObject = new GameObject();
            //			testAgentObject.name = "@NodeTestAgent_0";
            //			testAgentObject.transform.localPosition = Vector3.zero;
            //			testAgentObject.transform.localRotation = Quaternion.identity;
            //			testAgentObject.transform.localScale = Vector3.one;
            //			nodeTestAgent_0 = testAgentObject.AddComponent<AgentNodeTest>();
            //			nodeTestAgent_0.init();
            //
            //			testAgentObject = new GameObject();
            //			testAgentObject.name = "@ParTestAgent_0";
            //			testAgentObject.transform.localPosition = Vector3.zero;
            //			testAgentObject.transform.localRotation = Quaternion.identity;
            //			testAgentObject.transform.localScale = Vector3.one;
            //			parTestAgent_0 = testAgentObject.AddComponent<ParTestAgent>();
            //			parTestAgent_0.initAgent();
            //
            //			testAgentObject = new GameObject();
            //			testAgentObject.name = "@ParTestAgent_1";
            //			testAgentObject.transform.localPosition = Vector3.zero;
            //			testAgentObject.transform.localRotation = Quaternion.identity;
            //			testAgentObject.transform.localScale = Vector3.one;
            //			parTestAgent_1 = testAgentObject.AddComponent<ParTestAgent>();
            //			parTestAgent_1.initAgent();
            //
            //			testAgentObject = new GameObject();
            //			testAgentObject.name = "@ParTestAgent_2";
            //			testAgentObject.transform.localPosition = Vector3.zero;
            //			testAgentObject.transform.localRotation = Quaternion.identity;
            //			testAgentObject.transform.localScale = Vector3.one;
            //			parTestAgent_2 = testAgentObject.AddComponent<ParTestAgent>();
            //			parTestAgent_2.initAgent();
        }
Esempio n. 3
0
    public void resetProperties() {
        testVar_0 = -1;
        testVar_1 = -1;
        testVar_2 = -1.0f;
        testVar_3 = -1.0f;
        event_test_var_int = -1;
        event_test_var_bool = false;
        event_test_var_float = -1.0f;
        event_test_var_agent = null;
        waiting_timeout_interval = 0;

        action_0_enter_count = 0;
        action_0_exit_count = 0;
        action_1_enter_count = 0;
        action_1_exit_count = 0;
        action_2_enter_count = 0;
        action_2_exit_count = 0;

        testVar_str_0 = string.Empty;
        this.Variables.Clear();
    }
Esempio n. 4
0
        void once_(AgentNodeTest myTestAgent)
        {
            behaviac.Workspace.Instance.FrameSinceStartup = 0;

            behaviac.EBTStatus s = myTestAgent.btexec();
            Assert.AreEqual(behaviac.EBTStatus.BT_RUNNING, s);
            Assert.AreEqual(0, myTestAgent.testVar_0);

            behaviac.Workspace.Instance.FrameSinceStartup = behaviac.Workspace.Instance.FrameSinceStartup + 1;

            s = myTestAgent.btexec();
            Assert.AreEqual(behaviac.EBTStatus.BT_RUNNING, s);
            Assert.AreEqual(0, myTestAgent.testVar_0);

            behaviac.Workspace.Instance.FrameSinceStartup = behaviac.Workspace.Instance.FrameSinceStartup + 1;

            myTestAgent.testVar_0 = 1;

            //Move ends, testVar_0 = 2
            //Frames(5) is still running
            //testVar_0 = 0 again
            s = myTestAgent.btexec();
            Assert.AreEqual(behaviac.EBTStatus.BT_RUNNING, s);
            Assert.AreEqual(0, myTestAgent.testVar_0);

            behaviac.Workspace.Instance.FrameSinceStartup = behaviac.Workspace.Instance.FrameSinceStartup + 1;

            s = myTestAgent.btexec();
            Assert.AreEqual(behaviac.EBTStatus.BT_RUNNING, s);
            Assert.AreEqual(0, myTestAgent.testVar_0);

            behaviac.Workspace.Instance.FrameSinceStartup = behaviac.Workspace.Instance.FrameSinceStartup + 1;

            s = myTestAgent.btexec();
            Assert.AreEqual(behaviac.EBTStatus.BT_SUCCESS, s);
            Assert.AreEqual(3, myTestAgent.testVar_0);
        }
Esempio n. 5
0
 public void setEventVarAgent(AgentNodeTest agent)
 {
     event_test_var_agent = agent;
 }