Exemplo n.º 1
0
        public void SpeciesCry_PlaysAppropriateAudioClip()
        {
            _species.TestStart();
            const ECryType expectedCryType = ECryType.Positive;

            _species.SpeciesCry(expectedCryType);

            Assert.AreSame(_positiveClip, _species.PlayedAudioClip);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public CryAudioClipEntry(ECryType inCryType, AudioClip inCrySound)
 {
     CryType  = inCryType;
     CrySound = inCrySound;
 }
Exemplo n.º 7
0
 public bool IsSpeciesCryInProgress(ECryType inCryType)
 {
     return(_cryInProgress == inCryType);
 }
Exemplo n.º 8
0
 public bool IsSpeciesCryInProgress(ECryType inCryType)
 {
     IsSpeciesCryInProgressInput = inCryType;
     return(IsSpeciesCryInProgressResult);
 }
Exemplo n.º 9
0
 public void SpeciesCry(ECryType inCryType)
 {
     SpeciesCryCalled    = true;
     SpeciesCryTypeInput = inCryType;
 }
Exemplo n.º 10
0
 public SpeciesCryMessage(ECryType inCry)
     : base()
 {
     Cry = inCry;
 }