Exemplo n.º 1
0
        public FrameTimer(int frames)
        {
            linkHandler = new DisposableLinkHandler(false);

            ServiceCache.EventBus.Subscribe <T>(linkHandler, () =>
            {
                if (updateCondition != null)
                {
                    if (!updateCondition())
                    {
                        return;
                    }
                }

                var completed = elapsed > duration;

                elapsed += 1;

                if (!completed && elapsed >= duration)
                {
                    if (onCompleted != null)
                    {
                        onCompleted();
                    }
                }
            });

            this.duration = frames;
        }
Exemplo n.º 2
0
        public Timer(float seconds)
        {
            linkHandler = new DisposableLinkHandler(false);

            ServiceCache.EventBus.Subscribe <T>(linkHandler, e =>
            {
                if (updateCondition != null)
                {
                    if (!updateCondition())
                    {
                        return;
                    }
                }

                var completed = elapsed > duration;

                elapsed += Span.Seconds(e.DeltaTime);

                if (!completed && elapsed >= duration)
                {
                    if (onCompleted != null)
                    {
                        onCompleted();
                    }
                }
            });

            this.duration = Span.Seconds(seconds);
        }
Exemplo n.º 3
0
        public Clock()
        {
            linkHandler = new DisposableLinkHandler(false);

            ServiceCache.EventBus.Subscribe <T>(linkHandler, e =>
            {
                if (updateCondition != null)
                {
                    if (!updateCondition())
                    {
                        return;
                    }
                }

                elapsed += Span.Seconds(e.DeltaTime);
            });
        }
Exemplo n.º 4
0
        public FrameClock()
        {
            linkHandler = new DisposableLinkHandler(false);

            ServiceCache.EventBus.Subscribe <T>(linkHandler, () =>
            {
                if (updateCondition != null)
                {
                    if (!updateCondition())
                    {
                        return;
                    }
                }

                elapsed += 1;
            });
        }