Ejemplo n.º 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;
        }
    }
Ejemplo n.º 2
0
 public override void OnEvent(ClaimKill evnt)
 {
     state.Kills += 1;
     state.XP    += 5;
     PlayerManager.GetComponent <PlayerAuth>().XP += 5;
 }