void OnEnemyDied(NetworkMessage netMsg) { PlayerDead playerDied = netMsg.ReadMessage <PlayerDead>(); enemy victim = players[playerDied.victim].GetComponent <enemy>(); if (playerDied.killer == id) { addKill(); if (kills > maxPoints) { setRecordHolder(-1, kills); } if (baseDamage == -1 && victim.getMedia() != -1) { player.GetComponent <PController>().applyBoost(victim.getMedia()); } else if (baseDamage != -1 && victim.getMedia() == -1) { player.GetComponent <PController>().applyBoost(-1); } } else { enemy en = players[playerDied.killer].GetComponent <enemy>(); en.addKill(); if (en.getKills() > maxPoints) { setRecordHolder(en.getId(), en.getKills()); } } victim.die(); }
public void Dead(int id) { NetInt dead = new NetInt(); dead.value = id; nm.nc.Send(904, dead); UI.transform.localScale = new Vector3(0, 0, 0); respawnTimer.Start(nm.getConfiguration().respawnTime, "Sei stato eliminato da " + players[id].gameObject.transform.Find("username").GetComponent <TextMesh>().text); enemy e = players[id].GetComponent <enemy>(); e.addKill(); if (e.getKills() > maxPoints) { setRecordHolder(id, e.getKills()); } }