Exemple #1
0
        public void TestUpdateShort()
        {
            var linearPath = new LinearPath(Vector3.zero, Vector3.forward);
            var paths      = new List <PathDescription>()
            {
                new PathDescription(new DummyAIPath(linearPath), 0, 1)
            };

            var state = new AgentState(0, 0, null);

            var agent = new DummyStateAgent(state);

            GetSpeedDelegate getSpeed = s => 1.0f;

            AgentState newState;

            state.Update(agent, 1 / 60.0f, getSpeed, paths, out newState);

            Assert.AreEqual(1 / 60.0f, newState.Progress, 0.000001f);
        }
Exemple #2
0
        public void TestUpdateLong()
        {
            var linearPath = new LinearPath(Vector3.zero, Vector3.forward);
            var paths      = new List <PathDescription>()
            {
                new PathDescription(new DummyAIPath(linearPath), 0, 1)
            };

            var state = new AgentState(0, 0, null);

            var agent = new DummyStateAgent(state);

            GetSpeedDelegate getSpeed = s => 1.0f;

            AgentState newState;
            var        result = state.Update(agent, 1 + 1 / 60.0f, getSpeed, paths, out newState);

            Assert.IsTrue(result.HasFlag(AgentStateResult.Moved));
            Assert.IsTrue(result.HasFlag(AgentStateResult.ChangedPath));
            Assert.AreEqual(1 / 60.0f, newState.Progress, 0.000001f);
        }