Esempio n. 1
0
    public virtual void Death(DeathFX deathFX, Vector3 deathPosition, GameObject killingPlayer = null)
    {
        if (ReplayManager.Instance.isReplaying)
        {
            return;
        }

        if (playerState != PlayerState.Dead && GlobalVariables.Instance.GameState == GameStateEnum.Playing)
        {
            if (deathFX == DeathFX.Explosion || deathFX == DeathFX.All)
            {
                playerFX.DeathExplosionFX(deathPosition);
            }

            if (deathFX == DeathFX.Particles || deathFX == DeathFX.All)
            {
                playerFX.DeathParticles(deathPosition);
            }

            if (killingPlayer)
            {
                playerThatHit = killingPlayer.GetComponent <PlayersGameplay>();
            }

            StartCoroutine(DeathCoroutine());
        }
    }