/// <summary> /// Death animation when the player or object has lost all health /// </summary> private void DeathAnimation() { // Rotates player or object transform.localRotation = AnimMath.Slide(transform.localRotation, Quaternion.Euler(deathX, deathY, deathZ), percent); if (deathPos.y >= -deathLevel) // if the death position y is greater than or equal to negative death level { deathPos = transform.localPosition; // gets local position deathPos.y += Time.deltaTime * -2; // gets Y position for vector transform.localPosition = deathPos; // Moves player or object down if (playOnce) // if playOnce is true { SoundBoard.PlayDeath(); // Plays death sound playOnce = false; // turns to false to play only once } } }