private void Die() { gameObject.SetActive(false); OnPlayerDie?.Invoke(); Instantiate(deathEffect, transform.position, Quaternion.identity); SoundManager.instance.PlaySound(loseSound); }
private void OnCollisionEnter2D(Collision2D other) { if (!other.gameObject.CompareTag("Border")) { OnPlayerDie?.Invoke(); Destroy(this.gameObject); } }
private void Die() { OnPlayerDie?.Invoke(); ObjectsCollision.OnCoinCollect -= CollectCoin; ObjectsCollision.OnDeath -= Die; DOTween.Clear(true); }
public void PlayerDie() { UIManager.instance?.OpenLossPanel(); DisablePlayer(); PlayerEnterSafeArea(); isPlayerAlive = false; onPlayerDieCallBack?.Invoke(); SoundManager.instance?.PlayBGM("MainBGM"); }
public void LoseOneLife() { if (lifeRemaining >= 1) { lifeRemaining--; currentDamageReceived = 0; } if (lifeRemaining == 0) { onPlayerLoseLife -= LoseOneLife; onPlayerDie?.Invoke(); } }
IEnumerator DieProcess() { var arm = Camera.main.gameObject.GetComponent <SmoothJointArm>(); if (arm != null) { arm.target = null; } m_HitBox.enabled = false; m_SideBlockCollider.enabled = false; m_MovementCollider.enabled = false; yield return(new WaitForSeconds(4f)); OnPlayerDie.Invoke(); }
public void RaiseTheDead() { OnPlayerDie?.Invoke(false); SetInvulnerableTrue(); Vector2 toCentreVector = GameObjectsHolder.Instance.Centre.GetToCentreVector(rb2D.position); Vector2 toCentreDirection = toCentreVector.normalized; float toCentreDistance = toCentreVector.magnitude - Centre.CentreRadius; rb2D.velocity = Vector2.zero; float differenceBetweenMaxRaiseHeightAndCurrentPosition = maxRaiseHeight - toCentreDistance / 5f; float raiseHeight = differenceBetweenMaxRaiseHeightAndCurrentPosition >= minRaiseHeight ? differenceBetweenMaxRaiseHeightAndCurrentPosition : minRaiseHeight; float impulseVelocity = Mathf.Sqrt(raiseHeight * rb2D.mass * 2 * Gravity.GravityAcceleration * Gravity.GravityScale); rb2D.AddForce(-1 * toCentreDirection * impulseVelocity, ForceMode2D.Impulse); float fallingTime = Mathf.Sqrt(2 * (raiseHeight + toCentreDistance) / (Gravity.GravityAcceleration * Gravity.GravityScale)); // fallingTime учитывает только время падения; так же есть время взлёта Debug.Log($"Your falling time to the surface of the Centre after raise is {fallingTime}"); }
private void Die() { OnPlayerDie?.Invoke(true); GameManager.Instance.GameOver(); }
public void CallOnPlayerDie() { OnPlayerDie?.Invoke(); }