Esempio n. 1
0
        public void PageDoesNotPlayCompletionSound_WhenCompletedCriterionIsNotActiveInstruction()
        {
            MockCriterion secondCriterion = null;

            try
            {
                secondCriterion = ScriptableObject.CreateInstance <MockCriterion>();
                var secondInstruction = new TutorialParagraph
                {
                    m_Type     = ParagraphType.Instruction,
                    m_Criteria = new TypedCriterionCollection(
                        new[] { new TypedCriterion(new SerializedType(typeof(MockCriterion)), secondCriterion) }
                        )
                };
                m_Page.m_Paragraphs =
                    new TutorialParagraphCollection(new[] { m_Page.paragraphs.First(), secondInstruction });

                var playedSound = false;
                m_Page.playedCompletionSound += page => playedSound = true;

                secondCriterion.Complete(true);
                Assert.IsFalse(playedSound, "Played sound for second step when first step was not yet completed.");
            }
            finally
            {
                if (secondCriterion != null)
                {
                    UnityObject.DestroyImmediate(secondCriterion);
                }
            }
        }
Esempio n. 2
0
        public void SetUp()
        {
            m_Page = ScriptableObject.CreateInstance <TutorialPage>();

            var instructionParagraph = new TutorialParagraph();

            instructionParagraph.m_Type = ParagraphType.Instruction;

            m_Criterion = ScriptableObject.CreateInstance <MockCriterion>();
            var tc = new TypedCriterion(new SerializedType(typeof(MockCriterion)), m_Criterion);

            instructionParagraph.m_Criteria = new TypedCriterionCollection(new[] { tc });

            m_Page.m_Paragraphs = new TutorialParagraphCollection(new[] { instructionParagraph });

            m_Page.Initiate();
        }