Example #1
0
        public virtual bool Run(Renderable renderItem, float delta)
        {
            if (_start == default(DateTime))
                Start();

            return Update(renderItem, delta);
        }
Example #2
0
        public void AddChild(Renderable child)
        {
            if (child == null)
                return;

            child.Parent = this;
            Children.Add(child);
        }
Example #3
0
        protected override void Refresh(Renderable renderItem, float delta)
        {
            if (_fromPosition == -Vector2.One)
                _fromPosition = renderItem.LocalPosition;

            var newPosition = Vector2.Lerp(_fromPosition, _toPosition, Easing.Perform(_easeMode, Elapsed, (float)Duration.TotalSeconds));
            renderItem.LocalPosition = newPosition;
        }
Example #4
0
        protected override void Refresh(Renderable renderItem, float delta)
        {
            var sprite = renderItem as Sprite;

            if (sprite == null)
                return;

            sprite.Scale = MathHelper.Lerp(_from, _to, Easing.Perform(_easeMode, Elapsed, (float)Duration.TotalSeconds));
        }
Example #5
0
        protected override void End(Renderable renderItem)
        {
            var sprite = renderItem as Sprite;

            if (sprite == null)
                return;

            sprite.Scale = _to;
        }
Example #6
0
        protected override bool Update(Renderable renderItem, float delta)
        {
            if (_actions[0].Run(renderItem, delta))
                _actions.RemoveAt(0);

            if (_actions.Count > 0)
                return false;

            OnCompletion?.Invoke(null);
            return true;
        }
Example #7
0
        protected virtual bool Update(Renderable renderItem, float delta)
        {
            if (DateTime.Now < _start + Duration)
            {
                Refresh(renderItem, delta);
                return false;
            }

            End(renderItem);
            OnCompletion?.Invoke(null);
            return true;
        }
Example #8
0
        protected override bool Update(Renderable renderItem, float delta)
        {
            for (var i = 0; i < _actions.Count; i++)
            {
                if (!_actions[i].Run(renderItem, delta))
                    continue;

                _actions.RemoveAt(i--);
            }

            if (_actions.Count > 0)
                return false;

            OnCompletion?.Invoke(null);
            return true;
        }
Example #9
0
 protected virtual void Refresh(Renderable renderItem, float delta)
 {
 }
Example #10
0
 protected virtual void End(Renderable renderItem)
 {
 }
Example #11
0
 public void RemoveChild(Renderable child)
 {
     Children.Remove(child);
     child.Parent = null;
 }
Example #12
0
 protected override void End(Renderable renderItem)
 {
     renderItem.LocalPosition = _toPosition;
 }
Example #13
0
 protected override void Refresh(Renderable renderItem, float delta)
 {
     renderItem.SetAlpha(MathHelper.Lerp(_from, _to, Easing.Perform(_easeMode, Elapsed, (float)Duration.TotalSeconds)));
 }
Example #14
0
 protected override void End(Renderable renderItem)
 {
     renderItem.SetAlpha(_to);
 }