Exemple #1
0
        public void Update_NeedsAllConditionsToComplete()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var firstCondition  = new TestActionStateCondition();
            var secondCondition = new TestActionStateCondition();

            conditionRunner.AddCondition(firstCondition);
            conditionRunner.AddCondition(secondCondition);
            firstCondition.ForceComplete();

            conditionRunner.Update(1.0f);

            Assert.IsFalse(conditionRunner.IsComplete());
        }
Exemple #2
0
        public void Update_CallsStartOnConditionsOnceTheirTrackIsRunning()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var firstCondition  = new TestActionStateCondition();
            var secondCondition = new TestActionStateCondition();

            conditionRunner.AddCondition(firstCondition);
            conditionRunner.PushNewTrack();
            conditionRunner.AddCondition(secondCondition);
            firstCondition.ForceComplete();
            conditionRunner.Update(1.0f);
            conditionRunner.Update(1.0f);

            Assert.IsTrue(secondCondition.StartCalled);
        }
Exemple #3
0
        public void Update_OnlyEndsConditionOnceOnCompletion()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var firstCondition  = new TestActionStateCondition();
            var secondCondition = new TestActionStateCondition();

            conditionRunner.AddCondition(firstCondition);
            conditionRunner.AddCondition(secondCondition);
            firstCondition.ForceComplete();

            conditionRunner.Update(1.0f);
            conditionRunner.Update(1.0f);

            Assert.AreEqual(1, firstCondition.EndCalls);
        }
Exemple #4
0
        public void PushNewTrack_DoesNotUpdateNewTrackUntilPriorComplete()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var firstCondition  = new TestActionStateCondition();
            var secondCondition = new TestActionStateCondition();

            conditionRunner.AddCondition(firstCondition);
            conditionRunner.PushNewTrack();
            conditionRunner.AddCondition(secondCondition);
            firstCondition.ForceComplete();
            secondCondition.ForceComplete();

            conditionRunner.Update(1.0f);

            Assert.IsFalse(conditionRunner.IsComplete());
        }
Exemple #5
0
        private void InitialiseConditions()
        {
            var inputBinder = Info.Owner.GetComponent <IInputBinderInterface>();

            if (inputBinder != null)
            {
                _conditionRunner.AddCondition(new InputReceivedActionStateCondition(ValidProgressingInputs, inputBinder));
            }
        }
Exemple #6
0
        public void PushNewTrack_UpdateAfterPriorCompletesTrack()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var firstCondition  = new TestActionStateCondition();
            var secondCondition = new TestActionStateCondition();

            conditionRunner.AddCondition(firstCondition);
            conditionRunner.PushNewTrack();
            conditionRunner.AddCondition(secondCondition);
            firstCondition.ForceComplete();
            secondCondition.ForceComplete();

            conditionRunner.Update(1.0f);
            conditionRunner.Update(1.0f);

            Assert.IsTrue(conditionRunner.IsComplete());
        }
Exemple #7
0
        public void AddActionStateCondition_CallsStartIfOneTrack()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);

            Assert.IsTrue(condition.StartCalled);
        }
Exemple #8
0
        public void Complete_IncompleteCondition_False()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);

            Assert.IsFalse(conditionRunner.IsComplete());
        }
Exemple #9
0
        public void Update_ConditionDoesNotComplete_CompleteFalse()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);
            conditionRunner.Update(1.0f);

            Assert.IsFalse(conditionRunner.IsComplete());
        }
Exemple #10
0
        public void AddActionStateCondition_DoesNotCallStartIfNotOnRunningTrack()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.PushNewTrack();
            conditionRunner.AddCondition(condition);

            Assert.IsFalse(condition.StartCalled);
        }
Exemple #11
0
        public void ConditionCompletes_NeedsUpdateToCallEnd()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);
            condition.ForceComplete();

            Assert.AreEqual(0, condition.EndCalls);
        }
Exemple #12
0
        public void ConditionCompletes_NeedsUpdateToBeNotified()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);
            condition.ForceComplete();

            Assert.IsFalse(conditionRunner.IsComplete());
        }
Exemple #13
0
        public void Update_ConditionDoesComplete_CallsEnd()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var condition = new TestActionStateCondition();

            conditionRunner.AddCondition(condition);
            condition.ForceComplete();
            conditionRunner.Update(1.0f);

            Assert.AreEqual(1, condition.EndCalls);
        }
Exemple #14
0
        public void Update_CallsUpdateWithFloat()
        {
            var conditionRunner = new ActionStateConditionRunner();

            var         condition = new TestActionStateCondition();
            const float deltaTime = 12.0f;

            conditionRunner.AddCondition(condition);
            conditionRunner.Update(deltaTime);

            Assert.IsTrue(condition.UpdateCalled);
            Assert.AreEqual(deltaTime, condition.UpdateDelta);
        }