Exemple #1
0
        public virtual com.brashmonkey.spriter.animation.SpriterKeyFrame getNextFrameFor(
            com.brashmonkey.spriter.objects.SpriterAbstractObject @object, com.brashmonkey.spriter.animation.SpriterKeyFrame
            currentFrame, int direction)
        {
            com.brashmonkey.spriter.animation.SpriterKeyFrame nextFrame = null;
            int  cnt    = 0;
            bool isBone = @object is com.brashmonkey.spriter.objects.SpriterBone;

            for (int j = (currentFrame.getId() + direction + this.numberOfFrames()) % this.numberOfFrames();
                 nextFrame == null && cnt < this.numberOfFrames(); j = (j + direction + this.numberOfFrames()) %
                                                                       this.numberOfFrames(), cnt++)
            {
                com.brashmonkey.spriter.animation.SpriterKeyFrame frame = this.frames[j];
                bool contains = (isBone) ? frame.containsBone((com.brashmonkey.spriter.objects.SpriterBone
                                                               )@object) : frame.containsObject((com.brashmonkey.spriter.objects.SpriterObject)
                                                                                                @object);
                if (contains)
                {
                    com.brashmonkey.spriter.objects.SpriterAbstractObject objectInFrame;
                    if (isBone)
                    {
                        objectInFrame = frame.getBoneFor((com.brashmonkey.spriter.objects.SpriterBone)@object);
                    }
                    else
                    {
                        objectInFrame = frame.getObjectFor((com.brashmonkey.spriter.objects.SpriterObject)@object);
                    }
                    if (@object.equals(objectInFrame))
                    {
                        nextFrame = frame;
                    }
                }
            }
            return(nextFrame);
        }