Exemple #1
0
        public void Synchronize()
        {
            // Synchronize current GUI button animator with the related dummy element from the Spriter file
            var spriterDummyData = SpriterUtils.GetSpriterFileData(_replacedPartFilename, _referenceAnimator);

            if (spriterDummyData != null)
            {
                var dummyPosition = new Vector2(spriterDummyData.X, -spriterDummyData.Y);
                var dummyScale    = new Vector2(spriterDummyData.ScaleX, spriterDummyData.ScaleY);

                SubstituteAnimator.Position = _referenceAnimator.Position + dummyPosition;
                SubstituteAnimator.Rotation = -MathHelper.ToRadians(spriterDummyData.Angle);
                SubstituteAnimator.Scale    = dummyScale;
                SubstituteAnimator.Color    = new Color(SubstituteAnimator.Color, spriterDummyData.Alpha);
            }
        }
Exemple #2
0
        public void Synchronize()
        {
            // Synchronize current GUI button animator with the related dummy element from the Spriter file
            var spriterDummyData = SpriterUtils.GetSpriterFileData(_replacedPartFilename, _referenceAnimator, _timelineName);

            if (spriterDummyData != null && !_firstFrame)
            {
                var dummyPosition = new Vector2(spriterDummyData.X, -spriterDummyData.Y);
                var dummyScale    = new Vector2(spriterDummyData.ScaleX, spriterDummyData.ScaleY);

                SubstituteAnimator.Position = _referenceAnimator.Position + dummyPosition;
                SubstituteAnimator.Rotation = -MathHelper.ToRadians(spriterDummyData.Angle);
                SubstituteAnimator.Scale    = dummyScale;
                SubstituteAnimator.Color    = new Color(SubstituteAnimator.Color, spriterDummyData.Alpha);
            }
            else if (_firstFrame)
            {
                // Workaround to avoid desync on the first frame
                SubstituteAnimator.Scale = Vector2.Zero;
            }
        }