public void snapToRight() { var offset = -1; var pos = transform.position; pos.Set(ScreenAdapter.getHalfScreenWidth() + offset, pos.y, pos.z); transform.position = pos; }
void Awake() { Application.targetFrameRate = 60; var rect = GetComponent <RectTransform>().rect; ScreenAdapter.Setup(rect.width, rect.height, Screen.width, Screen.height); WorldConstant.Setup(); }
void Awake() { instance = this; screenRatio = ((float) Screen.height) / Screen.width; screenRatioReverse = ((float) Screen.width) / Screen.height; screenHeightUnit = 2 * Camera.main.orthographicSize; screenWidthUnit = screenHeightUnit * screenRatioReverse; screenWidthUnitHalf = screenWidthUnit * 0.5f; screenHeightUnitHalf = screenHeightUnit * 0.5f; }
public static Dictionary <int, float> RandomFixedXS(int min, int max) { var result = new Dictionary <int, float>(); var indexList = RandomFixedIndexes(min, max); foreach (var index in indexList) { var x = Constant.FIXED_XS[index]; result[index] = ScreenAdapter.AdaptScreenX(x); } return(result); }
public static void Setup() { LeftRoadX = ScreenAdapter.AdaptScreenX(Constant.LEFT_ROAD_X); RightRoadX = ScreenAdapter.AdaptScreenX(Constant.RIGHT_ROAD_X); BottomRoadY = ScreenAdapter.AdaptScreenY(Constant.BOTTOM_ROAD_Y); TopRoadY = ScreenAdapter.AdaptScreenY(Constant.TOP_ROAD_Y); GapDistance = ScreenAdapter.AdaptScreenHeight(Constant.GAP_DISTANCE); GapDuration = Constant.GAP_DURATION; AIDistance = ScreenAdapter.AdaptScreenHeight(Constant.AI_DISTANCE); StaticYps = ScreenAdapter.AdaptScreenHeight(Constant.STATIC_YPS); BarrierYps = ScreenAdapter.AdaptScreenHeight(Constant.BARRIER_YPS); PixelsPerMeter = ScreenAdapter.AdaptScreenHeight(Constant.PIXELS_PER_METER); }
public static float IndexFixedXS(int index) { var x = Constant.FIXED_XS[index]; return(ScreenAdapter.AdaptScreenX(x)); }