// Update is called once per frame void Update() { if (!playerDead) { if (database.player.playerHealth <= 0) { EndScreen("You ran out of lives!"); } else { database.player.currentPosition = transform.GetChild(0).transform.position.x - 13; //13 Is the starting position of the car in the world distanceCounter.text = "" + Mathf.Round(database.player.currentPosition) + "m"; } } if (playerInvincible == false) { carBody.color = Color.white; frontWheel.color = Color.white; backWheel.color = Color.white; } if (transform.GetChild(0).transform.position.y < -45 && !easterEggPlaying) { SoundManager.Instance().PlayMusic(easterEgg); easterEggPlaying = true; } else if (transform.GetChild(0).transform.position.y < -850) { Text AH = Instantiate(AHHH, parentCanvas); AH.transform.SetAsFirstSibling(); StartCoroutine(CombinedMovementScript.FadeInOutText(AH, 90)); } }
public void FadeInTest() { GameObject camera = new GameObject(); camera.AddComponent <Camera>(); GameObject canvas = new GameObject(); canvas.AddComponent <Canvas>(); GameObject fadeInText = new GameObject(); fadeInText.transform.parent = canvas.transform; fadeInText.AddComponent <Text>(); fadeInText.GetComponent <Text>().text = "This text is fading"; Color test = fadeInText.GetComponent <Text>().color; test.a = 0; fadeInText.GetComponent <Text>().color = test; CombinedMovementScript.FadeInOutText(fadeInText.GetComponent <Text>(), 1); Assert.GreaterOrEqual(fadeInText.GetComponent <Text>().color.a, 0.9f); }