Esempio n. 1
0
    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();
    }