Пример #1
0
    private void Die()
    {
        if (entity.IsOwner)
        {
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;

            var Event = PlayerKilled.Create();
            Event.Killed = entity;
            Event.Killer = LastDamaged;
            Event.Send();

            var Event2 = ClaimKill.Create(LastDamaged);
            Event2.Send();

            var Event3 = ClaimScore.Create(LastDamaged);
            Event3.Score = 100;
            Event3.Send();

            if (LastDamaged != entity)
            {
                LastDamaged.GetComponent <Player>().AddScore(100);
            }

            state.Deaths += 1;
            StartCoroutine(Respawn());
            if (LastDamaged == entity)
            {
                GuiManager.ShowDeathScreen("You've commited suicide...");
                if (state.Score > 0)
                {
                    state.Score -= 100;
                }
                if (state.Score < 0)
                {
                    state.Score = 0;
                }
            }
            else
            {
                GuiManager.ShowDeathScreen("You've been killed by: " + LastDamaged.GetComponent <Player>().state.Username);
            }
            GuiManager.ShowScoreBoard();
            gameObject.GetComponent <Renderer>().enabled = false;
        }
    }