void Dash() { decreasingDashSpeed = dashSpeed; rb2d.velocity = new Vector2(rb2d.velocity.x * dashSpeed, rb2d.velocity.y); if (allowDashSound) { playerAudioManager.Play("Dash"); allowDashSound = false; } }
public IEnumerator AddHealth(float healingAmount) { audioManager.Play("Heal"); postProcessEffect.SetActive(true); // Add healing amount to health health += healingAmount; // Cap health at max if (health > maxHealth) { health = maxHealth; } // Increase visual health amount for (int i = 0; i < healingAmount; i++) { if (visualHealth > maxHealth) // Health caps at max { visualHealth = maxHealth; } else { visualHealth++; // Add health by given amount } yield return(null); } // Disable post process so that it can be re-enabled by another health pickup Invoke("DisablePostProcess", .4f); }
// private void OnDestroy() // { // bulletCounter.DecreaseBulletAmount(); // Decrease bullet counter // } void TakeDamage(float damage) { onDamage.Invoke(); health -= damage; damageNumbers.OnHit(transform.position, damage); playerAudioManager.Play("Hitsound"); }
IEnumerator TypeSentence(string name, string sentence, Sprite left, Sprite right, bool enableButtons, int buttons) { nameText.text = name; leftTalkSprite.sprite = left; rightTalkSprite.sprite = right; dialogueText.text = ""; // Set the dialogue text to the current sentence foreach (char letter in sentence.ToCharArray()) { dialogueText.text += letter; audioManager.Play(name); // Play the current talk sound yield return(new WaitForSecondsRealtime(currentCharTime)); } if (!enableButtons) { nextButton.SetActive(true); } else { EnableDialogueButtons(buttons); } finishedSentence = true; }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) // If the player touches this { score.IncreaseScore(value); playerAudio.Play("CoinGet"); Destroy(this.transform.parent.gameObject); // Destroy this } }
private void Update() { // Enable movement if time it up if (!moving && Time.time > timeUntilMove) { sounds.Play("Suck"); rb2d.bodyType = RigidbodyType2D.Kinematic; moving = true; } }