public void RefreshUiWidth() { UiWidth = ViewRect.rect.width; float Ratio = UiWidth / 500f; TimingText.GetComponent <RectTransform>().anchoredPosition = new Vector2(10 * Ratio, 0); TimingText.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * Ratio, 30); SpeedText.GetComponent <RectTransform>().anchoredPosition = new Vector2(200 * Ratio, 0); SpeedText.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * Ratio, 30); }
void Start() { Instance = this; scoreText = ScoreText.GetComponent <Text>(); speedText = SpeedText.GetComponent <Text>(); Instantiate(playerPrefab, transform.position + Vector3.up, transform.rotation, transform); SpawnGround(groundForwardPrefab, this.transform); for (int i = 1; i < grounds.Length - 1; i++) { SpawnGround(GetRandomGround(), grounds[groundIndex].NextGround); } }