예제 #1
0
        public static Int32 Evaluate(Object state, ref Boolean error, Int32 value)
        {
            Combat.Character character = state as Combat.Character;
            if (character == null)
            {
                error = true;
                return(0);
            }

            Animations.Animation animation = character.AnimationManager.CurrentAnimation;
            if (animation == null)
            {
                error = true;
                return(0);
            }

            //Document states that if element == null, SFalse should be return. Testing seems to show that 0 is returned instead.

            Int32 element_index = value - 1;

            if (animation.Elements.Count <= element_index)
            {
                return(0);
            }

            Int32 animation_time    = character.AnimationManager.TimeInAnimation;
            Int32 element_starttime = animation.GetElementStartTime(element_index);

            Int32 result = animation_time - element_starttime;

            //if (animation.TotalTime != -1 && result >= animation.TotalTime) result = (result % animation.TotalTime);

            return(result);
        }
예제 #2
0
        public static Boolean Evaluate(Object state, ref Boolean error, Int32 r1, Int32 rhs, Operator compare_type)
        {
            Combat.Character character = state as Combat.Character;
            if (character == null)
            {
                error = true;
                return(false);
            }

            Animations.Animation animation = character.AnimationManager.CurrentAnimation;
            if (animation == null)
            {
                error = true;
                return(false);
            }

            Int32 elementindex = r1 - 1;

            if (elementindex < 0 || elementindex >= animation.Elements.Count)
            {
                error = true;
                return(false);
            }

            Int32 elementstarttime = animation.GetElementStartTime(elementindex);
            Int32 animationtime    = character.AnimationManager.TimeInAnimation;

            while (animation.TotalTime != -1 && animationtime >= animation.TotalTime)
            {
                Int32 looptime = animation.TotalTime - animation.GetElementStartTime(animation.Loopstart);
                animationtime -= looptime;
            }

            Int32 timeoffset = animationtime - elementstarttime;

            if (character.AnimationManager.IsAnimationFinished == true)
            {
                return(false);
            }

            Boolean result = SpecialFunctions.LogicalOperation(compare_type, timeoffset, rhs);

            return((compare_type == Operator.Equals) ? result && character.UpdatedAnimation : result);
        }
예제 #3
0
        public static Boolean Evaluate(Object state, ref Boolean error, Int32 r1, Int32 pre, Int32 post, Operator compare_type, Symbol pre_check, Symbol post_check)
        {
            Combat.Character character = state as Combat.Character;
            if (character == null)
            {
                error = true;
                return(false);
            }

            Animations.Animation animation = character.AnimationManager.CurrentAnimation;
            if (animation == null)
            {
                error = true;
                return(false);
            }

            Int32 elementindex = r1 - 1;

            if (elementindex < 0 || elementindex >= animation.Elements.Count)
            {
                error = true;
                return(false);
            }

            Int32 elementstarttime = animation.GetElementStartTime(elementindex);
            Int32 animationtime    = character.AnimationManager.TimeInAnimation;

            while (animation.TotalTime != -1 && animationtime >= animation.TotalTime)
            {
                Int32 looptime = animation.TotalTime - animation.GetElementStartTime(animation.Loopstart);
                animationtime -= looptime;
            }

            Int32 timeoffset = animationtime - elementstarttime;

            if (character.AnimationManager.IsAnimationFinished == true)
            {
                return(false);
            }

            return(SpecialFunctions.Range(timeoffset, pre, post, compare_type, pre_check, post_check));
        }