Beispiel #1
0
    public void KillPlayer()
    {
        if (currentState != PLAYER_STATE.DEAD)
        {
            currentState = PLAYER_STATE.DEAD;
            SetPlayerState();
            LevelCam.RemoveTarget(transform.name);
            playerStateEffect.deadStart = true;

            //Game needs to recive info about player death
            switch (StatHolder.CurrentMode)
            {
            case StatHolder.Modes.DM:
                roundManager.alivePlayers.Remove(this.gameObject);
                break;

            case StatHolder.Modes.TDM:
                if (color == Red)
                {
                    roundManager.alivePlayers.Remove(this.gameObject);
                    roundManager.redPlayers.Remove(this.gameObject);
                }
                else if (color == Blue)
                {
                    roundManager.alivePlayers.Remove(this.gameObject);
                    roundManager.bluePlayers.Remove(this.gameObject);
                }
                break;
            }
            roundManager.PlayerChecker();

            if (StatHolder.CurrentMode == StatHolder.Modes.DM && roundManager.alivePlayers.Count > 1)
            {
                audioScript.PlayKnockOutSound();
            }

            if (StatHolder.CurrentMode == StatHolder.Modes.TDM && roundManager.redPlayers.Count > 0 && roundManager.alivePlayers.Count > 1 || StatHolder.CurrentMode == StatHolder.Modes.TDM && roundManager.bluePlayers.Count > 0 && roundManager.alivePlayers.Count > 1)
            {
                if (roundManager.teamWon == false)
                {
                    audioScript.PlayKnockOutSound();
                }
            }
        }
    }