protected override void Death() { ControlsState(false); _gameStopwatch.Stop(); OnPlayerDied.Invoke(); }
private void OnCircleEaten(object sender, CircleEatenEventArgs eventArgs) { Score -= Math.Pow(eventArgs.Eaten.Radius, 2); if (PlayerCircles.Count == 0) { OnPlayerDied?.Invoke(this, new PlayerDiedEventArgs(this)); } }
public IEnumerator HandlePlayerDeath() { Explode(); yield return(new WaitForSeconds(0.4f)); gameObject.GetComponent <Rigidbody>().Sleep(); OnPlayerDied?.Invoke(); GetComponentInChildren <MeshRenderer>().forceRenderingOff = false; }
public void Die(bool scorePoints = false) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Debug.Log("Doug Dimmadome declares you dimma-dun-dead, son."); if (!debugNeverDie) { OnPlayerDied?.Invoke(); } }
public override void Enter() { OnPlayerDied?.Invoke(); player.controller2D.DisableCollisions(); // Disable collisions. // Disable listening for collision events. // Set y velocity to an arbitrary bounce height for death effect. // Maybe reset x velocity. }
public void GetDamage(float damage) { stats.HP -= damage; HPchanged?.Invoke(stats.HP >= 0f ? stats.HP : 0f); if (stats.HP <= 0f) { DestroyPlayer(); OnPlayerDied?.Invoke(this); } }
/// <summary> /// Deregisters a health from the dict. /// </summary> /// <param name="health">The health to be deregistered.</param> public void DeRegister(Health health) { if (health.TryGetComponent(out Player player)) { playerHealths.Remove(health); OnPlayerDied?.Invoke(player); if (playerHealths.Count == 0) { OnAllPlayersDied?.Invoke(); } } else if (health.TryGetComponent <Enemy>(out _)) { enemyHealths.Remove(health); if (enemyHealths.Count == 0) { OnAllEnemiesDied?.Invoke(); } } }
/// <summary> /// Call this method to update player damage. /// </summary> /// <param name="caller">Enemy object.</param> /// <param name="onComplete">Callback method when this action is complete</param> public void TakeDamage(object caller, UnityAction onComplete) { if (_isInvincible) { onComplete?.Invoke(); return; } if (caller.GetType() != typeof(BulletController) && caller.GetType() != typeof(LaserController) && caller.GetType() != typeof(BlueController) && caller.GetType() != typeof(RedController) && caller.GetType() != typeof(GreenController)) { onComplete?.Invoke(); return; } onComplete?.Invoke(); OnPlayerDied?.Invoke(); CharacterPool.Instance.ReturnToPool(this.gameObject); }
public void PlayerDied() { OnPlayerDied?.Invoke(this, new EventArgs()); }
private void RestInPeace() { OnPlayerDied.Invoke(this, EventArgs.Empty); }
public override void OnKilled() { Debug.Log("Player Ded."); _blocked = true; OnPlayerDied?.Invoke(); }
public void Die() { onPlayerDied.Invoke(); Destroy(gameObject); }
public void PlayerDied() { OnPlayerDied?.Invoke(); }
public static void OnPlayerDiedFunction() { OnPlayerDied?.Invoke(); }