Esempio n. 1
0
        public NotificationItem(float lifeTime, NotificationKind notificationKind, string message)
        {
            _spriteFont        = GameInstance.Content.Load <SpriteFont>(ResourceNames.Fonts.NotificationFont);
            _backgroundColor   = new Color(70, 70, 70);
            _notificationIcons = GameInstance.Content.Load <Texture2D>(ResourceNames.Textures.NotificationIcons);
            NotificationKind   = notificationKind;
            Message            = message;

            var transit = lifeTime * 0.125f;

            _remainingLifeTime = lifeTime - 2 * transit;

            EnterAnimation = new UiAlphaAnimation(transit, 0, 1);
            LeaveAnimation = new UiAlphaAnimation(transit, 1, 0);
        }
Esempio n. 2
0
        public Hexagon(Texture2D texture, int x, int y, bool hasAnimation)
        {
            _hexagonTexture = texture;
            Bounds          = new Rectangle(x * Width, y * Height - ((x % 2) * HeightHalf), texture.Width, texture.Height);
            var targetAlpha = Common.GlobalRandomProvider.Instance.Rnd.Next(MinAlpha, MaxAlpha);

            if (hasAnimation)
            {
                EnterAnimation = new UiAlphaAnimation(0.5f, 0.0f, targetAlpha / 255.0f)
                {
                    Delay = Math.Max(y * DelayVerticalOffsetMultiplier, 0)
                };
                Alpha = 0.0f;
            }
            else
            {
                Alpha = targetAlpha / 255.0f;
            }

            _changeAlphaAnimation = AddAnimation("ChangeAlpha", new UiAlphaAnimation(0.3f, 0, 1));
        }