public void OnAttack(GameObject attacker, Attack attack) { // Since the text is automatically facing the camera! We dont need to set the ScrollingText spawnedText = Instantiate(text, transform.position, Quaternion.identity); spawnedText.SetText(attack.Damage.ToString()); spawnedText.SetColor(textColor); }
void CreateBumper() { holdMouthOpen += 1.0f; GameObject newBumper = Instantiate(bumper); newBumper.transform.position = this.transform.position; newBumper.GetComponent <InterpolateToPosition>().StartInterpolationTo(targetBumperPosition.position); LevelManager.thingsToUnspawn.Add(newBumper); if (firstTime) { ScrollingText.SetText(new[] { "Tell no one..." }); firstTime = false; } }
private void Update() { if (mode == MonitorMode.Status) { float t; if (gameManager != null) { t = gameManager.DayCompleteAmount; } else { t = Mathf.Repeat(Time.time * 0.1f, 1f); } float hour = t * 30f * 8f; float minute = hour * 12; clockHour.localRotation = Quaternion.Euler(0f, 0f, 90f - hour); clockMinute.localRotation = Quaternion.Euler(0f, 0f, -minute); if (gameManager != null) { int brokenCount = gameManager.BrokenComponentCount; int functionalCount = gameManager.FunctionalComponentCount; if (brokenCount != prevBrokenCount || functionalCount != prevFunctionalCount) { prevBrokenCount = brokenCount; prevFunctionalCount = functionalCount; statusText.text = "OK: " + functionalCount + "\n" + "ERROR: " + brokenCount + "\n"; } if (gameManager.Dying == true) { SetMode(MonitorMode.Error); } if (gameManager.Day != updatedDay) { updatedDay = gameManager.Day; if (gameManager.Day == 1) { scrollingText.SetText("LOOK AROUND BY HOLDING DOWN YOUR RIGHT MOUSE BUTTON."); } else { scrollingText.SetText(messages[Random.Range(0, messages.Length)]); } } } } else if (mode == MonitorMode.Error) { countdownText.text = gameManager.DeadTimer.ToString("0.00"); if (!gameManager.Dying && !gameManager.Dead) { SetMode(MonitorMode.Status); } } if (gameManager != null && gameManager.WonTheGame) { SetMode(MonitorMode.Hired); } }