Example #1
0
        protected override void Death()
        {
            ControlsState(false);

            _gameStopwatch.Stop();
            OnPlayerDied.Invoke();
        }
Example #2
0
 private void OnCircleEaten(object sender, CircleEatenEventArgs eventArgs)
 {
     Score -= Math.Pow(eventArgs.Eaten.Radius, 2);
     if (PlayerCircles.Count == 0)
     {
         OnPlayerDied?.Invoke(this, new PlayerDiedEventArgs(this));
     }
 }
Example #3
0
        public IEnumerator HandlePlayerDeath()
        {
            Explode();
            yield return(new WaitForSeconds(0.4f));

            gameObject.GetComponent <Rigidbody>().Sleep();
            OnPlayerDied?.Invoke();
            GetComponentInChildren <MeshRenderer>().forceRenderingOff = false;
        }
Example #4
0
    public void Die(bool scorePoints = false)
    {
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        Debug.Log("Doug Dimmadome declares you dimma-dun-dead, son.");

        if (!debugNeverDie)
        {
            OnPlayerDied?.Invoke();
        }
    }
Example #5
0
    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);
            }
        }
Example #7
0
 /// <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);
    }
Example #9
0
 public void PlayerDied()
 {
     OnPlayerDied?.Invoke(this, new EventArgs());
 }
Example #10
0
 private void RestInPeace()
 {
     OnPlayerDied.Invoke(this, EventArgs.Empty);
 }
 public override void OnKilled()
 {
     Debug.Log("Player Ded.");
     _blocked = true;
     OnPlayerDied?.Invoke();
 }
Example #12
0
 public void Die()
 {
     onPlayerDied.Invoke();
     Destroy(gameObject);
 }
Example #13
0
 public void PlayerDied()
 {
     OnPlayerDied?.Invoke();
 }
 public static void OnPlayerDiedFunction()
 {
     OnPlayerDied?.Invoke();
 }