using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ColliderAdapter : MonoBehaviour
{
    public static ColliderAdapter Instance;
    //宽高比
    private float ScreenScale;
    //屏幕自适应参数
    private float ScreenAdaptParameter;

    //红线Y轴参数(自适应的前提下 红线的相对高低)
    private float RedLinePosYParameter;

    public float RedLinePosY;

    public Transform LeftCollider;
    public Transform RightCollider;
    public Transform BottomCollider;

    private void Awake()
    {
        Instance = this;

        ScreenScale = (float)Screen.height / Screen.width;
        ScreenAdaptParameter = ScreenScale / (1334f / 750f);

        RedLinePosYParameter = 0.8f;

        LeftCollider.position = new Vector3(LeftCollider.position.x / ScreenAdaptParameter, LeftCollider.position.y, LeftCollider.position.y);
        RightCollider.position = new Vector3(RightCollider.position.x / ScreenAdaptParameter, RightCollider.position.y, RightCollider.position.y);

        RedLinePosY = ((RightCollider.position.x - LeftCollider.position.x) * ScreenScale * RedLinePosYParameter) + BottomCollider.position.y;
    }

}
