Example #1
0
 public static CozyAnimationFrame Create(string path, float delayUnits)
 {
     var texture = CozyDirector.Instance.TextureCacheInstance.AddImage(path);
     var animate = new CozyAnimationFrame();
     animate.InitWithTexture(texture, delayUnits);
     return animate;
 }
Example #2
0
        public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
        {
            var animate = new CozyAnimationFrame();

            animate.InitWithTexture(texture, delayUnits);
            return(animate);
        }
Example #3
0
        public void AddFrame(CozyTexture texture)
        {
            var frame = CozyAnimationFrame.Create(texture, 1.0f);

            Frames.Add(frame);
            TotalDelayUnits++;
        }
Example #4
0
        public static CozyAnimationFrame Create(string path, float delayUnits)
        {
            var texture = CozyDirector.Instance.TextureCacheInstance.AddImage(path);
            var animate = new CozyAnimationFrame();

            animate.InitWithTexture(texture, delayUnits);
            return(animate);
        }
Example #5
0
        public override void Update(float dt)
        {
            if (dt < 1.0f)
            {
                dt *= Animaction.Loops;

                uint LoopNum = (uint)dt;
                if (LoopNum > ExecutedLoops)
                {
                    NextFrame = 0;
                    ExecutedLoops++;
                }

                dt = dt % 1.0f;
            }

            var         frames         = Animaction.Frames;
            int         numberOfFrames = frames.Count;
            CozyTexture frameToDisplay = null;

            for (int i = NextFrame; i < numberOfFrames; ++i)
            {
                float splitTime = SplitTimes[i];

                if (splitTime <= dt)
                {
                    CozyAnimationFrame frame = frames[i];
                    frameToDisplay = frame.Texture;
                    (Target as CozySprite).Texture = frameToDisplay;
                    NextFrame = i + 1;
                }
                else
                {
                    break;
                }
            }
        }
Example #6
0
 public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
 {
     var animate = new CozyAnimationFrame();
     animate.InitWithTexture(texture, delayUnits);
     return animate;
 }