﻿using UnityEngine;

namespace WhormholeExtreme.Extensions
{
    public static class RectExtensions
    {
        public static Rect CenterOnScreen(this Rect currentPart)
        {
            if (Screen.width > 0 ||
                Screen.height > 0 ||
                currentPart.width > 0f ||
                currentPart.height > 0f)
            {
                currentPart.x = ((Screen.width / 2) - (currentPart.width / 2));
                currentPart.y = ((Screen.height / 2) - (currentPart.height / 2));
            }

            return currentPart;
        }
    }
}
