private void Start() { if (SmackOnStart) { _textSmack.Smack(Math.Max(transform.localScale.x, 1f)); } }
private void Update() { _label.text = Commons.RoomGenerator.CurrentRoomConfig.Effect switch { RoomEffects.None => "", RoomEffects.LowGravity => "Low Gravity", RoomEffects.Darkness => "Dark", RoomEffects.ValuePickups => "2x Pickups", RoomEffects.FastFoe => "Fast-Foe", RoomEffects.LargeEnemies => "Large Enemies", RoomEffects.LargeProjectiles => "Large Projectiles", RoomEffects.ReverseControls => "Reversed Controls", RoomEffects.Icy => "Slippery", RoomEffects.Timer => "Time Limit", _ => "Multiple", }; if (!lastText.Equals(_label.text)) { _textSmack.Smack(transform.localScale.x); StartCoroutine(CoBlink()); } lastText = _label.text; }
private void Update() { if (_lastRoomNumber != (_lastRoomNumber = Commons.RoomGenerator.CurrentRoomNumber)) { _textMeshProUGUI.text = _lastRoomNumber.ToString(); _textSmack.Smack(); } }
// Update is called once per frame void Update() { //Find type of keys switch (KeyType) { case KeyTypeUI.General: _currentNumberOfKeys = _inventory.GeneralKeys; break; case KeyTypeUI.Puzzle: _currentNumberOfKeys = _inventory.PuzzleKeys; break; default: throw new InvalidOperationException(); } //if the number of keys hasn't changed if (_lastNumberOfKeys == _currentNumberOfKeys) { return; } _lastNumberOfKeys = _currentNumberOfKeys; //if the player has any keys if (_currentNumberOfKeys > 0) { //Set image to key sprite and smack Text.text = _currentNumberOfKeys.ToString(); _textSmack.Smack(); Image.sprite = _keySprite; ImageCopy.sprite = _keySprite; if (Image.enabled == false) { Image.enabled = true; ImageCopy.enabled = true; } } else { //Disable image and set text to nothing Text.text = ""; if (Image.enabled) { Image.enabled = false; ImageCopy.enabled = false; } } }
void Update() { if (Commons.RoomGenerator.CurrentRoomConfig.Class == RoomClass.Starting) { _timePassed = EscapeTime; } //If the player just pressed esc if (_timePassed >= 0) { //if this was the first time in a while since the last esc press. if (_tmp.text.Equals("[Esc]")) { //smack _textSmack.Smack(); } _tmp.text = "Press Esc to Quit"; _timePassed -= Time.deltaTime; //If esc is pressed again shortly after the first if (Input.GetKeyDown(KeyCode.Escape)) { //Quit Debug.Log("Shutting down"); Application.Quit(); } } //the player has not pressed esc else { _tmp.text = "[Esc]"; } if (Input.GetKeyDown(KeyCode.Escape)) { _timePassed = EscapeTime; } }
/// <summary> /// Counts up or down the currency counter /// </summary> /// <param name="startValue"></param> /// <returns></returns> private IEnumerator CoCount(int startValue) { int count = startValue; bool lastTickPlayedSound = false; while (count != _lastKnownCurrencyValue) { if (count > _lastKnownCurrencyValue) { count--; if (lastTickPlayedSound = !lastTickPlayedSound) { _multiSoundPlayer.PlaySound(0); } } else { count++; if (lastTickPlayedSound = !lastTickPlayedSound) { _multiSoundPlayer.PlaySound(1); } } SetLabel(count.ToString()); if (_smack != null) { _smack.Smack(); } yield return(new WaitForSecondsRealtime(0.05f)); } _counterRunning = false; }
/// <summary> /// Sets the health text /// </summary> /// <param name="health"></param> private void SetHealthText(int health) { _healthBarText.text = health.ToString(); _textSmack.Smack(); }
private void Start() { //start smack animation on start _smack = GetComponent <TextSmack>(); _smack.Smack(); }