Example #1
0
        float PlayNewEnemyAnimation()
        {
            ClipAnimSet newAnimSet = null;
            AnimKey     key        = new AnimKey(GetAnimState(), _animDirection);

            if (_animations.TryGetValue(key, out newAnimSet))
            {
                if (newAnimSet != currentAnimSet)
                {
                    bool     isLooping = key.State == AnimState.Idle || key.State == AnimState.Run || key.State == AnimState.Attack;
                    ClipAnim newAnim   = newAnimSet.GetNextAnim();
                    if (newAnim == null)
                    {
                        throw new InvalidOperationException("Could not find Enemy animation for " + key.State.ToString() + "-" + key.Direction.ToString());
                    }
                    else
                    {
                        ClipInstance.Play(newAnim, isLooping);
                    }
                    currentAnimSet = newAnimSet;
                }
                return(ClipInstance.CurrentAnim.DurationInSecondsRemaining);
            }
            return(0.0f);
        }
Example #2
0
        void PlayNewCharacterAnimation()
        {
            ClipAnimSet newAnimSet = null;

            if (_animations.TryGetValue(new AnimKey(CurrentState, CurrentWeapon, _animDirection),
                                        out newAnimSet))
            {
                if (newAnimSet != lastAnimSet)
                {
                    ClipInstance.Play(newAnimSet.GetNextAnim());
                    lastAnimSet = newAnimSet;
                }
            }
        }