public void SpeciesCry_PlaysAppropriateAudioClip()
        {
            _species.TestStart();
            const ECryType expectedCryType = ECryType.Positive;

            _species.SpeciesCry(expectedCryType);

            Assert.AreSame(_positiveClip, _species.PlayedAudioClip);
        }
        public void IsSpeciesCryInProgress_Finished_False()
        {
            _species.TestStart();

            const ECryType expectedCryType = ECryType.Positive;

            _species.SpeciesCry(expectedCryType);

            _species.TestUpdate(_positiveClip.length + 0.1f);

            Assert.IsFalse(_species.IsSpeciesCryInProgress(expectedCryType));
        }
示例#3
0
        public void SpeciesCry(ECryType inCryType)
        {
            if (!IsCryInProgress())
            {
                _cryInProgress = inCryType;
                UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(gameObject, new SpeciesCryMessage(_cryInProgress.Value));

                if (_speciesCryMap.ContainsKey(inCryType))
                {
                    _currentCry = _speciesCryMap[inCryType];

                    PlayAudioClip(_currentCry);
                }
            }
        }
        public void SpeciesCry_SendsSpeciesCryMessage()
        {
            _species.TestStart();
            const ECryType expectedCryType = ECryType.Positive;

            var messageSpy = new UnityTestMessageHandleResponseObject <SpeciesCryMessage>();

            var handle =
                UnityMessageEventFunctions.RegisterActionWithDispatcher <SpeciesCryMessage>(_species.gameObject,
                                                                                            messageSpy.OnResponse);

            _species.SpeciesCry(expectedCryType);

            Assert.IsTrue(messageSpy.ActionCalled);
            Assert.AreEqual(expectedCryType, messageSpy.MessagePayload.Cry);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_species.gameObject, handle);
        }
        public void SpeciesCry_UpdateLessThanLengthOfClip_CannotSendMessageAgain()
        {
            _species.TestStart();

            const ECryType expectedCryType = ECryType.Positive;

            _species.SpeciesCry(expectedCryType);

            _species.TestUpdate(_positiveClip.length - 0.1f);

            var messageSpy = new UnityTestMessageHandleResponseObject <SpeciesCryMessage>();

            var handle =
                UnityMessageEventFunctions.RegisterActionWithDispatcher <SpeciesCryMessage>(_species.gameObject,
                                                                                            messageSpy.OnResponse);

            _species.SpeciesCry(expectedCryType);

            Assert.IsFalse(messageSpy.ActionCalled);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_species.gameObject, handle);
        }
示例#6
0
 public CryAudioClipEntry(ECryType inCryType, AudioClip inCrySound)
 {
     CryType  = inCryType;
     CrySound = inCrySound;
 }
示例#7
0
 public bool IsSpeciesCryInProgress(ECryType inCryType)
 {
     return(_cryInProgress == inCryType);
 }
示例#8
0
 public bool IsSpeciesCryInProgress(ECryType inCryType)
 {
     IsSpeciesCryInProgressInput = inCryType;
     return(IsSpeciesCryInProgressResult);
 }
示例#9
0
 public void SpeciesCry(ECryType inCryType)
 {
     SpeciesCryCalled    = true;
     SpeciesCryTypeInput = inCryType;
 }
示例#10
0
 public SpeciesCryMessage(ECryType inCry)
     : base()
 {
     Cry = inCry;
 }