Example #1
0
        public Animation.Variable CreateAnimation(double initialValue, double finalValue, double duration)
        {
            var var = new Animation.Variable(AnimationManager, initialValue);

            AnimationManager.ScheduleTransition(var,
                                                TransitionLibrary.AccelerateDecelerate(duration, finalValue, 0.2, 0.8), DurationSinceStart.TotalSeconds);
            return(var);
        }
 public override void Dispose()
 {
     if (_var != null)
     {
         _var.Dispose();
         _var = null;
     }
 }
Example #3
0
        public void CreateQuote(BarrageDto barrage)
        {
            if (Status != QuoteStatus.Peath)
            {
                Clear();
            }

            _barrage = barrage;
            Status   = QuoteStatus.Quoting;
            _alpha   = Sprite.XResource.CreateAnimation(3.0, 0.0, QuoteDuration);
        }
Example #4
0
        private void Clear()
        {
            if (_alpha != null)
            {
                _alpha.Dispose();
                _alpha = null;
            }
            if (_barrage != null)
            {
                Sprite.XResource.TextLayouts.Remove(
                    _barrage.Text, FontSize);
                _barrage = null;
            }

            Status = QuoteStatus.Peath;
        }
        public override void Update(float dt)
        {
            base.Update(dt);

            if (PersonSprite.IsAlive)
            {
                return;
            }

            Sprite.Alpha = (float)_var.Value;
            if (_var.Value == _var.FinalValue)
            {
                _var.Dispose();
                _var = null;

                ((PersonSprite)Sprite).SetCanBeDelete();
            }
        }
Example #6
0
        public override void Update(float dt)
        {
            base.Update(dt);
            if (_alpha != null && _alpha.Value == _alpha.FinalValue)
            {
                switch (Status)
                {
                case QuoteStatus.Hiding:
                    Clear();
                    break;

                case QuoteStatus.Quoting:
                    Status = QuoteStatus.Hiding;
                    _alpha.Dispose();
                    _alpha = Sprite.XResource.CreateAnimation(1.0, 0.0, QuoteHidingDuration);
                    break;
                }
            }
        }
 public override void Kill()
 {
     PersonSprite.IsAlive = false;
     _var = Sprite.XResource.CreateAnimation(1.0f, 0.0f, KillingTime);
 }