private IEnumerator OpenScoreBoard() { totalScore = GameObject.FindGameObjectWithTag("TotalScore").GetComponent <Text>(); totalScore.text = "Totale Opbrengst: " + TotalPoints(); yield return(new WaitForSeconds(4f)); float height = Screen.height * 0.6f; float offset = height / connectedTeams.Count; for (int i = 0; i < connectedTeams.Count; i++) { ScoreObject temp = Instantiate(scoreObjectPrefab, childTransform).GetComponent <ScoreObject>(); temp.GetComponent <RectTransform>().localPosition = new Vector2(0, ((height * 0.5f) - (i * offset * 1.2f) - (offset * 0.5f))); //float size = offset / temp.GetComponent<RectTransform>().sizeDelta.y; //temp.GetComponent<RectTransform>().localScale = new Vector3(temp.GetComponent<RectTransform>().localScale.x, size, size); float ratio = 1f - (0.1f * i); temp.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width * 0.8f, offset * 0.5f); temp.teamName.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width * 0.8f, offset * (1.5f * ratio)); temp.img.GetComponent <RectTransform>().sizeDelta = new Vector2(offset * (1.5f * ratio), offset * (1.5f * ratio)); temp.score.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width * 0.1f, offset); temp.init(connectedTeams[i], i + 1); scoreObjects.Add(temp); yield return(new WaitForSeconds(0.2f)); } }
// Update is called once per frame void Update() { NewPoint(); if (Score > 0) { Time.timeScale = 1f; TimeLeft -= Time.deltaTime; float Display = Mathf.Round(TimeLeft); //TimeLeft = (float)Math.Round(TimeLeft, 2); Timer.GetComponent <TextMeshProUGUI>().text = Display.ToString(); } if (TimeLeft <= 0.0f) { Time.timeScale = 0f; GameDisplay.SetActive(false); ScoreDisplay.SetActive(true); ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score; if (!adShown) { Advertisement.Show(); adShown = true; } } }
public void Point() { WinningObject.SetActive(false); Score++; if (Score > 0) { Time.timeScale = 1f; } ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score; }
// Use this for initialization void Start() { Advertisement.Initialize(gameID); Time.timeScale = 0; ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score; }