private void Die() { IsDead = true; Health = 0; PlayerMovement movement = gameObject.GetComponent <PlayerMovement>(); movement.MovementEnabled = false; Animator animator = GetComponent <Animator>(); animator.enabled = false; double deathAnimationLength = 1.00d; if (DeathAudioClip != null) { BackgroundMusicSystem backgroundMusicSystem = transform.parent.GetComponentInChildren <BackgroundMusicSystem>(); backgroundMusicSystem.StopBackgroundMusic(); deathAnimationLength = DeathAudioClip.length; _audioSource.PlayOneShot(DeathAudioClip); } int z = 90; if (movement.IsFacingRight) { z *= -1; } gameObject.transform.Rotate(0, 0, z); Invoke("TrueDeath", Convert.ToSingle(deathAnimationLength * 1.15)); }
public void Start() { _scene = SceneManager.GetActiveScene(); _backgroundMusicSystem = GetComponentInChildren <BackgroundMusicSystem>(); if (!_fightStarted) { Invoke("StartFight", 24.5f); } }
public void Start() { _restartText = GameObject.Find("RestartText"); _coinText = GameObject.Find("GameOverCoinCount"); _backgroundMusicSystem = GetComponentInChildren <BackgroundMusicSystem>(); }