Exemplo n.º 1
0
        public void AdjustTransform(Transform transform, ScaleSettings setting)
        {
            if (setting.UseParent)
            {
                return;
            }

            if (!setting.SkipPosition)
            {
                transform.SetXPosition(transform.position.x * AspectRatio.x);
                transform.SetYPosition(transform.position.y * AspectRatio.y);
            }

            if (setting.ScaleX)
            {
                transform.ScaleX(AspectRatio.x);
            }
            else
            {
                transform.ScaleX(CameraRatio);
            }

            if (setting.ScaleY)
            {
                transform.ScaleY(AspectRatio.y);
            }
            else
            {
                transform.ScaleY(CameraRatio);
            }
        }
Exemplo n.º 2
0
        public void AdjustRect(ref Rect rect, ScaleSettings setting)
        {
            rect.x *= AspectRatio.x;
            rect.y *= AspectRatio.y;

            if (setting.ScaleX)
            {
                rect.width *= AspectRatio.x;
            }
            else
            {
                rect.width *= CameraRatio;
            }

            if (setting.ScaleY)
            {
                rect.height *= AspectRatio.y;
            }
            else
            {
                rect.height *= CameraRatio;
            }
        }