示例#1
0
        public void Play()
        {
            animationState = FtueAnimationState.Playing;

            FtueAnimationStep currentStep = CurrentSequence[currentStepNumber];

            Log.Debug(string.Format("Playing animation #{0} - {1} for {2}.", currentStepNumber, currentStep.Clip, currentStep.Agent));

            PlayClip(currentStep);
        }
示例#2
0
        private void PlayClip(FtueAnimationStep stepToPlay)
        {
            DOVirtual.DelayedCall(stepToPlay.Delay, () => {
                // playing the animation clip
                FtueAgent currentAgent = agents[(int)stepToPlay.Agent];
                currentAgent.PlayAnimation(stepToPlay.Clip);

                // playing the audio clip
                if (!string.IsNullOrEmpty(stepToPlay.SoundEvent))
                {
                    AudioEvent.Play(stepToPlay.SoundEvent, ftueAudioSource);
                }
            });
        }
示例#3
0
        public void Play(FtueType state, string clipName)
        {
            // saving ftue state
            ftueType = state;

            // getting animation clip data
            FtueAnimationStep stepToPlay = CurrentSequence.Where(step => string.Equals(step.Clip, clipName)).First();

            // getting step number
            currentStepNumber = CurrentSequence.IndexOf(stepToPlay);

            // playing animation
            PlayClip(stepToPlay);
        }
示例#4
0
        protected void OnFtueAnimationCompleteHandler(object sender, FtueAgentAnimationEvent eventArgs)
        {
            // setting state
            animationState = FtueAnimationState.Waiting;

            // getting the completed step
            FtueAnimationStep completedStep = CurrentSequence[currentStepNumber];

            // incrementing the event number
            currentStepNumber++;

            // checking if there are next steps
            if (currentStepNumber < CurrentSequence.Count)
            {
                if (completedStep.AutoPlay)
                {
                    if (OnFtueAnimationClipComplete != null)
                    {
                        OnFtueAnimationClipComplete(new FtueAgentAnimationEvent(completedStep.Agent, -1, completedStep.Clip));
                    }

                    if (!IsErrorState)
                    {
                        Play();
                    }
                }
                else
                {
                    if (OnFtueAnimationWaiting != null)
                    {
                        OnFtueAnimationWaiting(new FtueAgentAnimationEvent(completedStep.Agent, -1, completedStep.Clip));
                    }
                }
            }
            else
            {
                // dispatching the event
                if (OnFtueAnimationSequenceComplete != null)
                {
                    OnFtueAnimationSequenceComplete(ftueType);
                }
            }
        }